<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>xmpp.session</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="xmpp-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="xmpp-module.html">Package&nbsp;xmpp</a> ::
        Module&nbsp;session
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="xmpp.session-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="xmpp.session-module.html">Module xmpp.session</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-comment">##</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   XMPP server</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   Copyright (C) 2004 Alexey "Snake" Nezhdanov</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   This program is free software; you can redistribute it and/or modify</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   it under the terms of the GNU General Public License as published by</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   the Free Software Foundation; either version 2, or (at your option)</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   any later version.</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   This program is distributed in the hope that it will be useful,</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   but WITHOUT ANY WARRANTY; without even the implied warranty of</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt class="py-comment">##   GNU General Public License for more details.</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt id="link-0" class="py-name" targets="Variable xmpp.session.__version__=xmpp.session-module.html#__version__"><a title="xmpp.session.__version__" class="py-name" href="#" onclick="return doclink('link-0', '__version__', 'link-0');">__version__</a></tt><tt class="py-op">=</tt><tt class="py-docstring">"$Id"</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-string">"""</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-string">When your handler is called it is getting the session instance as the first argument.</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-string">This is the difference from xmpppy 0.1 where you got the "Client" instance.</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-string">With Session class you can have "multi-session" client instead of having</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-string">one client for each connection. Is is specifically important when you are</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-string">writing the server.</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-string">"""</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name" targets="Module xmpp.protocol=xmpp.protocol-module.html"><a title="xmpp.protocol" class="py-name" href="#" onclick="return doclink('link-1', 'protocol', 'link-1');">protocol</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-comment"># Transport-level flags</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt id="link-2" class="py-name" targets="Variable xmpp.session.SOCKET_UNCONNECTED=xmpp.session-module.html#SOCKET_UNCONNECTED"><a title="xmpp.session.SOCKET_UNCONNECTED" class="py-name" href="#" onclick="return doclink('link-2', 'SOCKET_UNCONNECTED', 'link-2');">SOCKET_UNCONNECTED</a></tt>  <tt class="py-op">=</tt><tt class="py-number">0</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt id="link-3" class="py-name" targets="Variable xmpp.session.SOCKET_ALIVE=xmpp.session-module.html#SOCKET_ALIVE"><a title="xmpp.session.SOCKET_ALIVE" class="py-name" href="#" onclick="return doclink('link-3', 'SOCKET_ALIVE', 'link-3');">SOCKET_ALIVE</a></tt>        <tt class="py-op">=</tt><tt class="py-number">1</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt id="link-4" class="py-name" targets="Variable xmpp.session.SOCKET_DEAD=xmpp.session-module.html#SOCKET_DEAD"><a title="xmpp.session.SOCKET_DEAD" class="py-name" href="#" onclick="return doclink('link-4', 'SOCKET_DEAD', 'link-4');">SOCKET_DEAD</a></tt>         <tt class="py-op">=</tt><tt class="py-number">2</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"><tt class="py-comment"># XML-level flags</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt id="link-5" class="py-name" targets="Variable xmpp.session.STREAM__NOT_OPENED=xmpp.session-module.html#STREAM__NOT_OPENED"><a title="xmpp.session.STREAM__NOT_OPENED" class="py-name" href="#" onclick="return doclink('link-5', 'STREAM__NOT_OPENED', 'link-5');">STREAM__NOT_OPENED</a></tt> <tt class="py-op">=</tt><tt class="py-number">1</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"><tt id="link-6" class="py-name" targets="Variable xmpp.session.STREAM__OPENED=xmpp.session-module.html#STREAM__OPENED"><a title="xmpp.session.STREAM__OPENED" class="py-name" href="#" onclick="return doclink('link-6', 'STREAM__OPENED', 'link-6');">STREAM__OPENED</a></tt>     <tt class="py-op">=</tt><tt class="py-number">2</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line"><tt id="link-7" class="py-name" targets="Variable xmpp.session.STREAM__CLOSING=xmpp.session-module.html#STREAM__CLOSING"><a title="xmpp.session.STREAM__CLOSING" class="py-name" href="#" onclick="return doclink('link-7', 'STREAM__CLOSING', 'link-7');">STREAM__CLOSING</a></tt>    <tt class="py-op">=</tt><tt class="py-number">3</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line"><tt id="link-8" class="py-name" targets="Variable xmpp.session.STREAM__CLOSED=xmpp.session-module.html#STREAM__CLOSED"><a title="xmpp.session.STREAM__CLOSED" class="py-name" href="#" onclick="return doclink('link-8', 'STREAM__CLOSED', 'link-8');">STREAM__CLOSED</a></tt>     <tt class="py-op">=</tt><tt class="py-number">4</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"><tt class="py-comment"># XMPP-session flags</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line"><tt class="py-comment"></tt><tt id="link-9" class="py-name" targets="Variable xmpp.session.SESSION_NOT_AUTHED=xmpp.session-module.html#SESSION_NOT_AUTHED"><a title="xmpp.session.SESSION_NOT_AUTHED" class="py-name" href="#" onclick="return doclink('link-9', 'SESSION_NOT_AUTHED', 'link-9');">SESSION_NOT_AUTHED</a></tt> <tt class="py-op">=</tt><tt class="py-number">1</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line"><tt id="link-10" class="py-name" targets="Variable xmpp.session.SESSION_AUTHED=xmpp.session-module.html#SESSION_AUTHED"><a title="xmpp.session.SESSION_AUTHED" class="py-name" href="#" onclick="return doclink('link-10', 'SESSION_AUTHED', 'link-10');">SESSION_AUTHED</a></tt>     <tt class="py-op">=</tt><tt class="py-number">2</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt id="link-11" class="py-name" targets="Variable xmpp.session.SESSION_BOUND=xmpp.session-module.html#SESSION_BOUND"><a title="xmpp.session.SESSION_BOUND" class="py-name" href="#" onclick="return doclink('link-11', 'SESSION_BOUND', 'link-11');">SESSION_BOUND</a></tt>      <tt class="py-op">=</tt><tt class="py-number">3</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt id="link-12" class="py-name" targets="Variable xmpp.session.SESSION_OPENED=xmpp.session-module.html#SESSION_OPENED"><a title="xmpp.session.SESSION_OPENED" class="py-name" href="#" onclick="return doclink('link-12', 'SESSION_OPENED', 'link-12');">SESSION_OPENED</a></tt>     <tt class="py-op">=</tt><tt class="py-number">4</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt id="link-13" class="py-name" targets="Variable xmpp.session.SESSION_CLOSED=xmpp.session-module.html#SESSION_CLOSED"><a title="xmpp.session.SESSION_CLOSED" class="py-name" href="#" onclick="return doclink('link-13', 'SESSION_CLOSED', 'link-13');">SESSION_CLOSED</a></tt>     <tt class="py-op">=</tt><tt class="py-number">5</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"> </tt>
<a name="Session"></a><div id="Session-def"><a name="L44"></a><tt class="py-lineno"> 44</tt> <a class="py-toggle" href="#" id="Session-toggle" onclick="return toggle('Session');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="xmpp.session.Session-class.html">Session</a><tt class="py-op">:</tt> </tt>
</div><div id="Session-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Session-expanded"><a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"><tt class="py-docstring">    The Session class instance is used for storing all session-related info like </tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"><tt class="py-docstring">    credentials, socket/xml stream/session state flags, roster items (in case of</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"><tt class="py-docstring">    client type connection) etc.</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"><tt class="py-docstring">    Session object have no means of discovering is any info is ready to be read.</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line"><tt class="py-docstring">    Instead you should use poll() (recomended) or select() methods for this purpose.</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"><tt class="py-docstring">    Session can be one of two types: 'server' and 'client'. 'server' session handles</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line"><tt class="py-docstring">    inbound connection and 'client' one used to create an outbound one.</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line"><tt class="py-docstring">    Session instance have multitude of internal attributes. The most imporant is the 'peer' one.</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"><tt class="py-docstring">    It is set once the peer is authenticated (client).</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="Session.__init__"></a><div id="Session.__init__-def"><a name="L56"></a><tt class="py-lineno"> 56</tt> <a class="py-toggle" href="#" id="Session.__init__-toggle" onclick="return toggle('Session.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">socket</tt><tt class="py-op">,</tt><tt class="py-param">owner</tt><tt class="py-op">,</tt><tt class="py-param">xmlns</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">peer</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.__init__-expanded"><a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">        <tt class="py-docstring">""" When the session is created it's type (client/server) is determined from the beginning.</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line"><tt class="py-docstring">            socket argument is the pre-created socket-like object.</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line"><tt class="py-docstring">            It must have the following methods: send, recv, fileno, close.</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"><tt class="py-docstring">            owner is the 'master' instance that have Dispatcher plugged into it and generally</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"><tt class="py-docstring">            will take care about all session events.</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"><tt class="py-docstring">            xmlns is the stream namespace that will be used. Client must set this argument</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"><tt class="py-docstring">            If server sets this argument than stream will be dropped if opened with some another namespace.</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line"><tt class="py-docstring">            peer is the name of peer instance. This is the flag that differentiates client session from</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line"><tt class="py-docstring">            server session. Client must set it to the name of the server that will be connected, server must</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line"><tt class="py-docstring">            leave this argument alone.</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"><tt class="py-docstring">            """</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmlns</tt><tt class="py-op">=</tt><tt class="py-name">xmlns</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">peer</tt><tt class="py-op">:</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">TYP</tt><tt class="py-op">=</tt><tt class="py-string">'client'</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">peer</tt><tt class="py-op">=</tt><tt class="py-name">peer</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_socket_state</tt><tt class="py-op">=</tt><tt id="link-14" class="py-name"><a title="xmpp.session.SOCKET_UNCONNECTED" class="py-name" href="#" onclick="return doclink('link-14', 'SOCKET_UNCONNECTED', 'link-2');">SOCKET_UNCONNECTED</a></tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">TYP</tt><tt class="py-op">=</tt><tt class="py-string">'server'</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">peer</tt><tt class="py-op">=</tt><tt class="py-name">None</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_socket_state</tt><tt class="py-op">=</tt><tt id="link-15" class="py-name"><a title="xmpp.session.SOCKET_ALIVE" class="py-name" href="#" onclick="return doclink('link-15', 'SOCKET_ALIVE', 'link-3');">SOCKET_ALIVE</a></tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_sock</tt><tt class="py-op">=</tt><tt class="py-name">socket</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_send</tt><tt class="py-op">=</tt><tt class="py-name">socket</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name" targets="Method xmpp.dispatcher.Dispatcher.send()=xmpp.dispatcher.Dispatcher-class.html#send,Method xmpp.transports.TCPsocket.send()=xmpp.transports.TCPsocket-class.html#send"><a title="xmpp.dispatcher.Dispatcher.send
xmpp.transports.TCPsocket.send" class="py-name" href="#" onclick="return doclink('link-16', 'send', 'link-16');">send</a></tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_recv</tt><tt class="py-op">=</tt><tt class="py-name">socket</tt><tt class="py-op">.</tt><tt class="py-name">recv</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">fileno</tt><tt class="py-op">=</tt><tt class="py-name">socket</tt><tt class="py-op">.</tt><tt class="py-name">fileno</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_registered</tt><tt class="py-op">=</tt><tt class="py-number">0</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line"> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-17" class="py-name" targets="Class xmpp.dispatcher.Dispatcher=xmpp.dispatcher.Dispatcher-class.html"><a title="xmpp.dispatcher.Dispatcher" class="py-name" href="#" onclick="return doclink('link-17', 'Dispatcher', 'link-17');">Dispatcher</a></tt><tt class="py-op">=</tt><tt class="py-name">owner</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="xmpp.dispatcher.Dispatcher" class="py-name" href="#" onclick="return doclink('link-18', 'Dispatcher', 'link-17');">Dispatcher</a></tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">DBG_LINE</tt><tt class="py-op">=</tt><tt class="py-string">'session'</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Method xmpp.client.PlugIn.DEBUG()=xmpp.client.PlugIn-class.html#DEBUG,Method xmpp.simplexml.NodeBuilder.DEBUG()=xmpp.simplexml.NodeBuilder-class.html#DEBUG,Method xmpp.transports.HTTPPROXYsocket.DEBUG()=xmpp.transports.HTTPPROXYsocket-class.html#DEBUG"><a title="xmpp.client.PlugIn.DEBUG
xmpp.simplexml.NodeBuilder.DEBUG
xmpp.transports.HTTPPROXYsocket.DEBUG" class="py-name" href="#" onclick="return doclink('link-19', 'DEBUG', 'link-19');">DEBUG</a></tt><tt class="py-op">=</tt><tt class="py-name">owner</tt><tt class="py-op">.</tt><tt id="link-20" class="py-name"><a title="xmpp.dispatcher.Dispatcher" class="py-name" href="#" onclick="return doclink('link-20', 'Dispatcher', 'link-17');">Dispatcher</a></tt><tt class="py-op">.</tt><tt id="link-21" class="py-name"><a title="xmpp.client.PlugIn.DEBUG
xmpp.simplexml.NodeBuilder.DEBUG
xmpp.transports.HTTPPROXYsocket.DEBUG" class="py-name" href="#" onclick="return doclink('link-21', 'DEBUG', 'link-19');">DEBUG</a></tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_expected</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">=</tt><tt class="py-name">owner</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">TYP</tt><tt class="py-op">==</tt><tt class="py-string">'server'</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name" targets="Variable xmpp.dispatcher.ID=xmpp.dispatcher-module.html#ID"><a title="xmpp.dispatcher.ID" class="py-name" href="#" onclick="return doclink('link-22', 'ID', 'link-22');">ID</a></tt><tt class="py-op">=</tt><tt class="py-op">`</tt><tt class="py-name">random</tt><tt class="py-op">.</tt><tt class="py-name">random</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">`</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name"><a title="xmpp.dispatcher.ID" class="py-name" href="#" onclick="return doclink('link-23', 'ID', 'link-22');">ID</a></tt><tt class="py-op">=</tt><tt class="py-name">None</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line"> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sendbuffer</tt><tt class="py-op">=</tt><tt class="py-string">''</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_pos_queued</tt><tt class="py-op">=</tt><tt class="py-name">None</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_pos_sent</tt><tt class="py-op">=</tt><tt class="py-number">0</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_key_queue</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_queue_map</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">stanza_queue</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line"> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_session_state</tt><tt class="py-op">=</tt><tt id="link-24" class="py-name"><a title="xmpp.session.SESSION_NOT_AUTHED" class="py-name" href="#" onclick="return doclink('link-24', 'SESSION_NOT_AUTHED', 'link-9');">SESSION_NOT_AUTHED</a></tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">waiting_features</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt id="link-25" class="py-name" targets="Method xmpp.session.Session.feature()=xmpp.session.Session-class.html#feature"><a title="xmpp.session.Session.feature" class="py-name" href="#" onclick="return doclink('link-25', 'feature', 'link-25');">feature</a></tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt id="link-26" class="py-name" targets="Variable xmpp.protocol.NS_TLS=xmpp.protocol-module.html#NS_TLS"><a title="xmpp.protocol.NS_TLS" class="py-name" href="#" onclick="return doclink('link-26', 'NS_TLS', 'link-26');">NS_TLS</a></tt><tt class="py-op">,</tt><tt id="link-27" class="py-name" targets="Variable xmpp.protocol.NS_SASL=xmpp.protocol-module.html#NS_SASL"><a title="xmpp.protocol.NS_SASL" class="py-name" href="#" onclick="return doclink('link-27', 'NS_SASL', 'link-27');">NS_SASL</a></tt><tt class="py-op">,</tt><tt id="link-28" class="py-name" targets="Variable xmpp.protocol.NS_BIND=xmpp.protocol-module.html#NS_BIND"><a title="xmpp.protocol.NS_BIND" class="py-name" href="#" onclick="return doclink('link-28', 'NS_BIND', 'link-28');">NS_BIND</a></tt><tt class="py-op">,</tt><tt id="link-29" class="py-name" targets="Variable xmpp.protocol.NS_SESSION=xmpp.protocol-module.html#NS_SESSION"><a title="xmpp.protocol.NS_SESSION" class="py-name" href="#" onclick="return doclink('link-29', 'NS_SESSION', 'link-29');">NS_SESSION</a></tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt id="link-30" class="py-name"><a title="xmpp.session.Session.feature" class="py-name" href="#" onclick="return doclink('link-30', 'feature', 'link-25');">feature</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">owner</tt><tt class="py-op">.</tt><tt id="link-31" class="py-name" targets="Module xmpp.features=xmpp.features-module.html"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-31', 'features', 'link-31');">features</a></tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">waiting_features</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt id="link-32" class="py-name"><a title="xmpp.session.Session.feature" class="py-name" href="#" onclick="return doclink('link-32', 'feature', 'link-25');">feature</a></tt><tt class="py-op">)</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-33" class="py-name"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-33', 'features', 'link-31');">features</a></tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">feature_in_process</tt><tt class="py-op">=</tt><tt class="py-name">None</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">slave_session</tt><tt class="py-op">=</tt><tt class="py-name">None</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-34" class="py-name" targets="Method xmpp.session.Session.StartStream()=xmpp.session.Session-class.html#StartStream"><a title="xmpp.session.Session.StartStream" class="py-name" href="#" onclick="return doclink('link-34', 'StartStream', 'link-34');">StartStream</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line"> </tt>
<a name="Session.StartStream"></a><div id="Session.StartStream-def"><a name="L107"></a><tt class="py-lineno">107</tt> <a class="py-toggle" href="#" id="Session.StartStream-toggle" onclick="return toggle('Session.StartStream');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#StartStream">StartStream</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.StartStream-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.StartStream-expanded"><a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">        <tt class="py-docstring">""" This method is used to initialise the internal xml expat parser</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line"><tt class="py-docstring">            and to send initial stream header (in case of client connection).</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line"><tt class="py-docstring">            Should be used after initial connection and after every stream restart."""</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_state</tt><tt class="py-op">=</tt><tt id="link-35" class="py-name"><a title="xmpp.session.STREAM__NOT_OPENED" class="py-name" href="#" onclick="return doclink('link-35', 'STREAM__NOT_OPENED', 'link-5');">STREAM__NOT_OPENED</a></tt> </tt>
<a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">=</tt><tt id="link-36" class="py-name" targets="Module xmpp.simplexml=xmpp.simplexml-module.html"><a title="xmpp.simplexml" class="py-name" href="#" onclick="return doclink('link-36', 'simplexml', 'link-36');">simplexml</a></tt><tt class="py-op">.</tt><tt id="link-37" class="py-name" targets="Class xmpp.simplexml.NodeBuilder=xmpp.simplexml.NodeBuilder-class.html"><a title="xmpp.simplexml.NodeBuilder" class="py-name" href="#" onclick="return doclink('link-37', 'NodeBuilder', 'link-37');">NodeBuilder</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">.</tt><tt class="py-name">_dispatch_depth</tt><tt class="py-op">=</tt><tt class="py-number">2</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">.</tt><tt id="link-38" class="py-name" targets="Method xmpp.dispatcher.Dispatcher.dispatch()=xmpp.dispatcher.Dispatcher-class.html#dispatch,Method xmpp.simplexml.NodeBuilder.dispatch()=xmpp.simplexml.NodeBuilder-class.html#dispatch"><a title="xmpp.dispatcher.Dispatcher.dispatch
xmpp.simplexml.NodeBuilder.dispatch" class="py-name" href="#" onclick="return doclink('link-38', 'dispatch', 'link-38');">dispatch</a></tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-39" class="py-name" targets="Method xmpp.session.Session._dispatch()=xmpp.session.Session-class.html#_dispatch"><a title="xmpp.session.Session._dispatch" class="py-name" href="#" onclick="return doclink('link-39', '_dispatch', 'link-39');">_dispatch</a></tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Parse</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">.</tt><tt class="py-name">Parse</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name" targets="Method xmpp.simplexml.NodeBuilder.stream_footer_received()=xmpp.simplexml.NodeBuilder-class.html#stream_footer_received"><a title="xmpp.simplexml.NodeBuilder.stream_footer_received" class="py-name" href="#" onclick="return doclink('link-40', 'stream_footer_received', 'link-40');">stream_footer_received</a></tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-41" class="py-name" targets="Method xmpp.session.Session._stream_close()=xmpp.session.Session-class.html#_stream_close"><a title="xmpp.session.Session._stream_close" class="py-name" href="#" onclick="return doclink('link-41', '_stream_close', 'link-41');">_stream_close</a></tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">TYP</tt><tt class="py-op">==</tt><tt class="py-string">'client'</tt><tt class="py-op">:</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name" targets="Method xmpp.simplexml.NodeBuilder.stream_header_received()=xmpp.simplexml.NodeBuilder-class.html#stream_header_received"><a title="xmpp.simplexml.NodeBuilder.stream_header_received" class="py-name" href="#" onclick="return doclink('link-42', 'stream_header_received', 'link-42');">stream_header_received</a></tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-43" class="py-name" targets="Method xmpp.session.Session._catch_stream_id()=xmpp.session.Session-class.html#_catch_stream_id"><a title="xmpp.session.Session._catch_stream_id" class="py-name" href="#" onclick="return doclink('link-43', '_catch_stream_id', 'link-43');">_catch_stream_id</a></tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-44" class="py-name" targets="Method xmpp.session.Session._stream_open()=xmpp.session.Session-class.html#_stream_open"><a title="xmpp.session.Session._stream_open" class="py-name" href="#" onclick="return doclink('link-44', '_stream_open', 'link-44');">_stream_open</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="xmpp.simplexml.NodeBuilder.stream_header_received" class="py-name" href="#" onclick="return doclink('link-45', 'stream_header_received', 'link-42');">stream_header_received</a></tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name"><a title="xmpp.session.Session._stream_open" class="py-name" href="#" onclick="return doclink('link-46', '_stream_open', 'link-44');">_stream_open</a></tt> </tt>
</div><a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line"> </tt>
<a name="Session.receive"></a><div id="Session.receive-def"><a name="L123"></a><tt class="py-lineno">123</tt> <a class="py-toggle" href="#" id="Session.receive-toggle" onclick="return toggle('Session.receive');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#receive">receive</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.receive-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.receive-expanded"><a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">        <tt class="py-docstring">""" Reads all pending incoming data.</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line"><tt class="py-docstring">            Raises IOError on disconnection.</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line"><tt class="py-docstring">            Blocks until at least one byte is read."""</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> <tt class="py-name">received</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_recv</tt><tt class="py-op">(</tt><tt class="py-number">10240</tt><tt class="py-op">)</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt><tt class="py-op">:</tt> <tt class="py-name">received</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line"> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">received</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-comment"># length of 0 means disconnect</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-47" class="py-name"><a title="xmpp.client.PlugIn.DEBUG
xmpp.simplexml.NodeBuilder.DEBUG
xmpp.transports.HTTPPROXYsocket.DEBUG" class="py-name" href="#" onclick="return doclink('link-47', 'DEBUG', 'link-19');">DEBUG</a></tt><tt class="py-op">(</tt><tt class="py-op">`</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">fileno</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">`</tt><tt class="py-op">+</tt><tt class="py-string">' '</tt><tt class="py-op">+</tt><tt class="py-name">received</tt><tt class="py-op">,</tt><tt class="py-string">'got'</tt><tt class="py-op">)</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-48" class="py-name"><a title="xmpp.client.PlugIn.DEBUG
xmpp.simplexml.NodeBuilder.DEBUG
xmpp.transports.HTTPPROXYsocket.DEBUG" class="py-name" href="#" onclick="return doclink('link-48', 'DEBUG', 'link-19');">DEBUG</a></tt><tt class="py-op">(</tt><tt class="py-string">'Socket error while receiving data'</tt><tt class="py-op">,</tt><tt class="py-string">'error'</tt><tt class="py-op">)</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-49" class="py-name" targets="Method xmpp.session.Session.set_socket_state()=xmpp.session.Session-class.html#set_socket_state"><a title="xmpp.session.Session.set_socket_state" class="py-name" href="#" onclick="return doclink('link-49', 'set_socket_state', 'link-49');">set_socket_state</a></tt><tt class="py-op">(</tt><tt id="link-50" class="py-name"><a title="xmpp.session.SOCKET_DEAD" class="py-name" href="#" onclick="return doclink('link-50', 'SOCKET_DEAD', 'link-4');">SOCKET_DEAD</a></tt><tt class="py-op">)</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">IOError</tt><tt class="py-op">(</tt><tt class="py-string">"Peer disconnected"</tt><tt class="py-op">)</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">received</tt> </tt>
</div><a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line"> </tt>
<a name="Session.sendnow"></a><div id="Session.sendnow-def"><a name="L138"></a><tt class="py-lineno">138</tt> <a class="py-toggle" href="#" id="Session.sendnow-toggle" onclick="return toggle('Session.sendnow');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#sendnow">sendnow</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">chunk</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.sendnow-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.sendnow-expanded"><a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">        <tt class="py-docstring">""" Put chunk into "immidiatedly send" queue.</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line"><tt class="py-docstring">            Should only be used for auth/TLS stuff and like.</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line"><tt class="py-docstring">            If you just want to shedule regular stanza for delivery use enqueue method.</tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">chunk</tt><tt class="py-op">,</tt><tt id="link-51" class="py-name" targets="Class xmpp.simplexml.Node=xmpp.simplexml.Node-class.html"><a title="xmpp.simplexml.Node" class="py-name" href="#" onclick="return doclink('link-51', 'Node', 'link-51');">Node</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-name">chunk</tt> <tt class="py-op">=</tt> <tt class="py-name">chunk</tt><tt class="py-op">.</tt><tt id="link-52" class="py-name" targets="Method xmpp.protocol.JID.__str__()=xmpp.protocol.JID-class.html#__str__,Method xmpp.simplexml.Node.__str__()=xmpp.simplexml.Node-class.html#__str__,Method xmpp.transports.error.__str__()=xmpp.transports.error-class.html#__str__"><a title="xmpp.protocol.JID.__str__
xmpp.simplexml.Node.__str__
xmpp.transports.error.__str__" class="py-name" href="#" onclick="return doclink('link-52', '__str__', 'link-52');">__str__</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'utf-8'</tt><tt class="py-op">)</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">type</tt><tt class="py-op">(</tt><tt class="py-name">chunk</tt><tt class="py-op">)</tt><tt class="py-op">==</tt><tt class="py-name">type</tt><tt class="py-op">(</tt><tt class="py-string">u''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-name">chunk</tt> <tt class="py-op">=</tt> <tt class="py-name">chunk</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'utf-8'</tt><tt class="py-op">)</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-53" class="py-name" targets="Method xmpp.session.Session.enqueue()=xmpp.session.Session-class.html#enqueue"><a title="xmpp.session.Session.enqueue" class="py-name" href="#" onclick="return doclink('link-53', 'enqueue', 'link-53');">enqueue</a></tt><tt class="py-op">(</tt><tt class="py-name">chunk</tt><tt class="py-op">)</tt> </tt>
</div><a name="L146"></a><tt class="py-lineno">146</tt>  <tt class="py-line"> </tt>
<a name="Session.enqueue"></a><div id="Session.enqueue-def"><a name="L147"></a><tt class="py-lineno">147</tt> <a class="py-toggle" href="#" id="Session.enqueue-toggle" onclick="return toggle('Session.enqueue');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#enqueue">enqueue</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">stanza</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.enqueue-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.enqueue-expanded"><a name="L148"></a><tt class="py-lineno">148</tt>  <tt class="py-line">        <tt class="py-docstring">""" Takes Protocol instance as argument.</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt>  <tt class="py-line"><tt class="py-docstring">            Puts stanza into "send" fifo queue. Items into the send queue are hold until</tt> </tt>
<a name="L150"></a><tt class="py-lineno">150</tt>  <tt class="py-line"><tt class="py-docstring">            stream authenticated. After that this method is effectively the same as "sendnow" method."""</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">stanza</tt><tt class="py-op">,</tt><tt id="link-54" class="py-name" targets="Class xmpp.protocol.Protocol=xmpp.protocol.Protocol-class.html"><a title="xmpp.protocol.Protocol" class="py-name" href="#" onclick="return doclink('link-54', 'Protocol', 'link-54');">Protocol</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">stanza_queue</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">stanza</tt><tt class="py-op">)</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sendbuffer</tt><tt class="py-op">+=</tt><tt class="py-name">stanza</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_socket_state</tt><tt class="py-op">&gt;=</tt><tt id="link-55" class="py-name"><a title="xmpp.session.SOCKET_ALIVE" class="py-name" href="#" onclick="return doclink('link-55', 'SOCKET_ALIVE', 'link-3');">SOCKET_ALIVE</a></tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-56" class="py-name" targets="Method xmpp.session.Session.push_queue()=xmpp.session.Session-class.html#push_queue"><a title="xmpp.session.Session.push_queue" class="py-name" href="#" onclick="return doclink('link-56', 'push_queue', 'link-56');">push_queue</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L155"></a><tt class="py-lineno">155</tt>  <tt class="py-line"> </tt>
<a name="Session.push_queue"></a><div id="Session.push_queue-def"><a name="L156"></a><tt class="py-lineno">156</tt> <a class="py-toggle" href="#" id="Session.push_queue-toggle" onclick="return toggle('Session.push_queue');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#push_queue">push_queue</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">failreason</tt><tt class="py-op">=</tt><tt id="link-57" class="py-name" targets="Variable xmpp.ERR_RECIPIENT_UNAVAILABLE=xmpp-module.html#ERR_RECIPIENT_UNAVAILABLE,Variable xmpp.auth.ERR_RECIPIENT_UNAVAILABLE=xmpp.auth-module.html#ERR_RECIPIENT_UNAVAILABLE,Variable xmpp.browser.ERR_RECIPIENT_UNAVAILABLE=xmpp.browser-module.html#ERR_RECIPIENT_UNAVAILABLE,Variable xmpp.commands.ERR_RECIPIENT_UNAVAILABLE=xmpp.commands-module.html#ERR_RECIPIENT_UNAVAILABLE,Variable xmpp.dispatcher.ERR_RECIPIENT_UNAVAILABLE=xmpp.dispatcher-module.html#ERR_RECIPIENT_UNAVAILABLE,Variable xmpp.features.ERR_RECIPIENT_UNAVAILABLE=xmpp.features-module.html#ERR_RECIPIENT_UNAVAILABLE,Variable xmpp.filetransfer.ERR_RECIPIENT_UNAVAILABLE=xmpp.filetransfer-module.html#ERR_RECIPIENT_UNAVAILABLE,Variable xmpp.protocol.ERR_RECIPIENT_UNAVAILABLE=xmpp.protocol-module.html#ERR_RECIPIENT_UNAVAILABLE,Variable xmpp.roster.ERR_RECIPIENT_UNAVAILABLE=xmpp.roster-module.html#ERR_RECIPIENT_UNAVAILABLE,Variable xmpp.session.ERR_RECIPIENT_UNAVAILABLE=xmpp.session-module.html#ERR_RECIPIENT_UNAVAILABLE,Variable xmpp.transports.ERR_RECIPIENT_UNAVAILABLE=xmpp.transports-module.html#ERR_RECIPIENT_UNAVAILABLE"><a title="xmpp.ERR_RECIPIENT_UNAVAILABLE
xmpp.auth.ERR_RECIPIENT_UNAVAILABLE
xmpp.browser.ERR_RECIPIENT_UNAVAILABLE
xmpp.commands.ERR_RECIPIENT_UNAVAILABLE
xmpp.dispatcher.ERR_RECIPIENT_UNAVAILABLE
xmpp.features.ERR_RECIPIENT_UNAVAILABLE
xmpp.filetransfer.ERR_RECIPIENT_UNAVAILABLE
xmpp.protocol.ERR_RECIPIENT_UNAVAILABLE
xmpp.roster.ERR_RECIPIENT_UNAVAILABLE
xmpp.session.ERR_RECIPIENT_UNAVAILABLE
xmpp.transports.ERR_RECIPIENT_UNAVAILABLE" class="py-name" href="#" onclick="return doclink('link-57', 'ERR_RECIPIENT_UNAVAILABLE', 'link-57');">ERR_RECIPIENT_UNAVAILABLE</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.push_queue-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.push_queue-expanded"><a name="L157"></a><tt class="py-lineno">157</tt>  <tt class="py-line">        <tt class="py-docstring">""" If stream is authenticated than move items from "send" queue to "immidiatedly send" queue.</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt>  <tt class="py-line"><tt class="py-docstring">            Else if the stream is failed then return all queued stanzas with error passed as argument.</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt>  <tt class="py-line"><tt class="py-docstring">            Otherwise do nothing."""</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt>  <tt class="py-line">        <tt class="py-comment"># If the stream authed - convert stanza_queue into sendbuffer and set the checkpoints</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_state</tt><tt class="py-op">&gt;=</tt><tt id="link-58" class="py-name"><a title="xmpp.session.STREAM__CLOSED" class="py-name" href="#" onclick="return doclink('link-58', 'STREAM__CLOSED', 'link-8');">STREAM__CLOSED</a></tt> <tt class="py-keyword">or</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_socket_state</tt><tt class="py-op">&gt;=</tt><tt id="link-59" class="py-name"><a title="xmpp.session.SOCKET_DEAD" class="py-name" href="#" onclick="return doclink('link-59', 'SOCKET_DEAD', 'link-4');">SOCKET_DEAD</a></tt><tt class="py-op">:</tt> <tt class="py-comment"># the stream failed. Return all stanzas that are still waiting for delivery.</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt class="py-name">deactivatesession</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">key</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_key_queue</tt><tt class="py-op">:</tt>                                          <tt class="py-comment"># Not sure. May be I</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-60" class="py-name"><a title="xmpp.session.Session._dispatch" class="py-name" href="#" onclick="return doclink('link-60', '_dispatch', 'link-39');">_dispatch</a></tt><tt class="py-op">(</tt><tt id="link-61" class="py-name" targets="Class xmpp.protocol.Error=xmpp.protocol.Error-class.html"><a title="xmpp.protocol.Error" class="py-name" href="#" onclick="return doclink('link-61', 'Error', 'link-61');">Error</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_queue_map</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">failreason</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">trusted</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> <tt class="py-comment"># should simply re-dispatch it?</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt>  <tt class="py-line">            <tt class="py-keyword">for</tt> <tt class="py-name">stanza</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">stanza_queue</tt><tt class="py-op">:</tt>                                            <tt class="py-comment"># But such action can invoke</tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-62" class="py-name"><a title="xmpp.session.Session._dispatch" class="py-name" href="#" onclick="return doclink('link-62', '_dispatch', 'link-39');">_dispatch</a></tt><tt class="py-op">(</tt><tt id="link-63" class="py-name"><a title="xmpp.protocol.Error" class="py-name" href="#" onclick="return doclink('link-63', 'Error', 'link-61');">Error</a></tt><tt class="py-op">(</tt><tt class="py-name">stanza</tt><tt class="py-op">,</tt><tt class="py-name">failreason</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">trusted</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">)</tt>                      <tt class="py-comment"># Infinite loops in case of S2S connection...</tt> </tt>
<a name="L168"></a><tt class="py-lineno">168</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_queue_map</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_key_queue</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">stanza_queue</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">,</tt><tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_session_state</tt><tt class="py-op">&gt;=</tt><tt id="link-64" class="py-name"><a title="xmpp.session.SESSION_AUTHED" class="py-name" href="#" onclick="return doclink('link-64', 'SESSION_AUTHED', 'link-10');">SESSION_AUTHED</a></tt><tt class="py-op">:</tt>       <tt class="py-comment"># FIXME! &#228;&#207;&#204;&#214;&#197;&#206; &#194;&#217;&#212;&#216; &#203;&#193;&#203;&#207;&#202;-&#212;&#207; &#196;&#210;&#213;&#199;&#207;&#202; &#198;&#204;&#193;&#199;.</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt>  <tt class="py-line">            <tt class="py-comment">#### LOCK_QUEUE</tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-keyword">for</tt> <tt class="py-name">stanza</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">stanza_queue</tt><tt class="py-op">:</tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt>  <tt class="py-line">                <tt class="py-name">txt</tt><tt class="py-op">=</tt><tt class="py-name">stanza</tt><tt class="py-op">.</tt><tt id="link-65" class="py-name"><a title="xmpp.protocol.JID.__str__
xmpp.simplexml.Node.__str__
xmpp.transports.error.__str__" class="py-name" href="#" onclick="return doclink('link-65', '__str__', 'link-52');">__str__</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'utf-8'</tt><tt class="py-op">)</tt> </tt>
<a name="L174"></a><tt class="py-lineno">174</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sendbuffer</tt><tt class="py-op">+=</tt><tt class="py-name">txt</tt> </tt>
<a name="L175"></a><tt class="py-lineno">175</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_pos_queued</tt><tt class="py-op">+=</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">txt</tt><tt class="py-op">)</tt>       <tt class="py-comment"># should be re-evaluated for SSL connection.</tt> </tt>
<a name="L176"></a><tt class="py-lineno">176</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_queue_map</tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_pos_queued</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">stanza</tt>     <tt class="py-comment"># position of the stream when stanza will be successfully and fully sent</tt> </tt>
<a name="L177"></a><tt class="py-lineno">177</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_key_queue</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_pos_queued</tt><tt class="py-op">)</tt> </tt>
<a name="L178"></a><tt class="py-lineno">178</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">stanza_queue</tt><tt class="py-op">=</tt><tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
</div><a name="L179"></a><tt class="py-lineno">179</tt>  <tt class="py-line">            <tt class="py-comment">#### UNLOCK_QUEUE</tt> </tt>
<a name="L180"></a><tt class="py-lineno">180</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="Session.flush_queue"></a><div id="Session.flush_queue-def"><a name="L181"></a><tt class="py-lineno">181</tt> <a class="py-toggle" href="#" id="Session.flush_queue-toggle" onclick="return toggle('Session.flush_queue');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#flush_queue">flush_queue</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.flush_queue-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.flush_queue-expanded"><a name="L182"></a><tt class="py-lineno">182</tt>  <tt class="py-line">        <tt class="py-docstring">""" Put the "immidiatedly send" queue content on the wire. Blocks until at least one byte sent."""</tt> </tt>
<a name="L183"></a><tt class="py-lineno">183</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sendbuffer</tt><tt class="py-op">:</tt> </tt>
<a name="L184"></a><tt class="py-lineno">184</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L185"></a><tt class="py-lineno">185</tt>  <tt class="py-line">                <tt class="py-comment"># LOCK_QUEUE</tt> </tt>
<a name="L186"></a><tt class="py-lineno">186</tt>  <tt class="py-line"><tt class="py-comment"></tt>                <tt class="py-name">sent</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_send</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sendbuffer</tt><tt class="py-op">)</tt>    <tt class="py-comment"># &#226;&#204;&#207;&#203;&#201;&#210;&#213;&#192;&#221;&#193;&#209; &#219;&#212;&#213;&#222;&#203;&#193;!</tt> </tt>
<a name="L187"></a><tt class="py-lineno">187</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
<a name="L188"></a><tt class="py-lineno">188</tt>  <tt class="py-line">                <tt class="py-comment"># UNLOCK_QUEUE</tt> </tt>
<a name="L189"></a><tt class="py-lineno">189</tt>  <tt class="py-line"><tt class="py-comment"></tt>                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-66" class="py-name"><a title="xmpp.session.Session.set_socket_state" class="py-name" href="#" onclick="return doclink('link-66', 'set_socket_state', 'link-49');">set_socket_state</a></tt><tt class="py-op">(</tt><tt id="link-67" class="py-name"><a title="xmpp.session.SOCKET_DEAD" class="py-name" href="#" onclick="return doclink('link-67', 'SOCKET_DEAD', 'link-4');">SOCKET_DEAD</a></tt><tt class="py-op">)</tt> </tt>
<a name="L190"></a><tt class="py-lineno">190</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-68" class="py-name"><a title="xmpp.client.PlugIn.DEBUG
xmpp.simplexml.NodeBuilder.DEBUG
xmpp.transports.HTTPPROXYsocket.DEBUG" class="py-name" href="#" onclick="return doclink('link-68', 'DEBUG', 'link-19');">DEBUG</a></tt><tt class="py-op">(</tt><tt class="py-string">"Socket error while sending data"</tt><tt class="py-op">,</tt><tt class="py-string">'error'</tt><tt class="py-op">)</tt> </tt>
<a name="L191"></a><tt class="py-lineno">191</tt>  <tt class="py-line">                <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-69" class="py-name" targets="Method xmpp.session.Session.terminate_stream()=xmpp.session.Session-class.html#terminate_stream"><a title="xmpp.session.Session.terminate_stream" class="py-name" href="#" onclick="return doclink('link-69', 'terminate_stream', 'link-69');">terminate_stream</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L192"></a><tt class="py-lineno">192</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-70" class="py-name"><a title="xmpp.client.PlugIn.DEBUG
xmpp.simplexml.NodeBuilder.DEBUG
xmpp.transports.HTTPPROXYsocket.DEBUG" class="py-name" href="#" onclick="return doclink('link-70', 'DEBUG', 'link-19');">DEBUG</a></tt><tt class="py-op">(</tt><tt class="py-op">`</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">fileno</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">`</tt><tt class="py-op">+</tt><tt class="py-string">' '</tt><tt class="py-op">+</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sendbuffer</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-name">sent</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-string">'sent'</tt><tt class="py-op">)</tt> </tt>
<a name="L193"></a><tt class="py-lineno">193</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_pos_sent</tt><tt class="py-op">+=</tt><tt class="py-name">sent</tt> </tt>
<a name="L194"></a><tt class="py-lineno">194</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sendbuffer</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">sendbuffer</tt><tt class="py-op">[</tt><tt class="py-name">sent</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
<a name="L195"></a><tt class="py-lineno">195</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_pos_delivered</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_pos_sent</tt>            <tt class="py-comment"># Should be acquired from socket somehow. Take SSL into account.</tt> </tt>
<a name="L196"></a><tt class="py-lineno">196</tt>  <tt class="py-line">            <tt class="py-keyword">while</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_key_queue</tt> <tt class="py-keyword">and</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_pos_delivered</tt><tt class="py-op">&gt;</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_key_queue</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L197"></a><tt class="py-lineno">197</tt>  <tt class="py-line">                <tt class="py-keyword">del</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_queue_map</tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_key_queue</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">]</tt> </tt>
<a name="L198"></a><tt class="py-lineno">198</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_key_queue</tt><tt class="py-op">.</tt><tt class="py-name">remove</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">deliver_key_queue</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="L199"></a><tt class="py-lineno">199</tt>  <tt class="py-line">            <tt class="py-comment"># UNLOCK_QUEUE</tt> </tt>
<a name="L200"></a><tt class="py-lineno">200</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="Session._dispatch"></a><div id="Session._dispatch-def"><a name="L201"></a><tt class="py-lineno">201</tt> <a class="py-toggle" href="#" id="Session._dispatch-toggle" onclick="return toggle('Session._dispatch');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#_dispatch">_dispatch</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">stanza</tt><tt class="py-op">,</tt><tt class="py-param">trusted</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session._dispatch-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session._dispatch-expanded"><a name="L202"></a><tt class="py-lineno">202</tt>  <tt class="py-line">        <tt class="py-docstring">""" This is callback that is used to pass the received stanza forth to owner's dispatcher</tt> </tt>
<a name="L203"></a><tt class="py-lineno">203</tt>  <tt class="py-line"><tt class="py-docstring">            _if_ the stream is authorised. Otherwise the stanza is just dropped.</tt> </tt>
<a name="L204"></a><tt class="py-lineno">204</tt>  <tt class="py-line"><tt class="py-docstring">            The 'trusted' argument is used to emulate stanza receive.</tt> </tt>
<a name="L205"></a><tt class="py-lineno">205</tt>  <tt class="py-line"><tt class="py-docstring">            This method is used internally.</tt> </tt>
<a name="L206"></a><tt class="py-lineno">206</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L207"></a><tt class="py-lineno">207</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt class="py-name">packets</tt><tt class="py-op">+=</tt><tt class="py-number">1</tt> </tt>
<a name="L208"></a><tt class="py-lineno">208</tt>  <tt class="py-line">        <tt class="py-keyword">print</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt class="py-name">packets</tt> </tt>
<a name="L209"></a><tt class="py-lineno">209</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_state</tt><tt class="py-op">==</tt><tt id="link-71" class="py-name"><a title="xmpp.session.STREAM__OPENED" class="py-name" href="#" onclick="return doclink('link-71', 'STREAM__OPENED', 'link-6');">STREAM__OPENED</a></tt> <tt class="py-keyword">or</tt> <tt class="py-name">trusted</tt><tt class="py-op">:</tt>               <tt class="py-comment"># if the server really should reject all stanzas after he is closed stream (himeself)?</tt> </tt>
<a name="L210"></a><tt class="py-lineno">210</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-72" class="py-name"><a title="xmpp.client.PlugIn.DEBUG
xmpp.simplexml.NodeBuilder.DEBUG
xmpp.transports.HTTPPROXYsocket.DEBUG" class="py-name" href="#" onclick="return doclink('link-72', 'DEBUG', 'link-19');">DEBUG</a></tt><tt class="py-op">(</tt><tt class="py-name">stanza</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name"><a title="xmpp.protocol.JID.__str__
xmpp.simplexml.Node.__str__
xmpp.transports.error.__str__" class="py-name" href="#" onclick="return doclink('link-73', '__str__', 'link-52');">__str__</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-string">'dispatch'</tt><tt class="py-op">)</tt> </tt>
<a name="L211"></a><tt class="py-lineno">211</tt>  <tt class="py-line">            <tt class="py-name">stanza</tt><tt class="py-op">.</tt><tt class="py-name">trusted</tt><tt class="py-op">=</tt><tt class="py-name">trusted</tt> </tt>
<a name="L212"></a><tt class="py-lineno">212</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-74" class="py-name"><a title="xmpp.dispatcher.Dispatcher" class="py-name" href="#" onclick="return doclink('link-74', 'Dispatcher', 'link-17');">Dispatcher</a></tt><tt class="py-op">.</tt><tt id="link-75" class="py-name"><a title="xmpp.dispatcher.Dispatcher.dispatch
xmpp.simplexml.NodeBuilder.dispatch" class="py-name" href="#" onclick="return doclink('link-75', 'dispatch', 'link-38');">dispatch</a></tt><tt class="py-op">(</tt><tt class="py-name">stanza</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
</div><a name="L213"></a><tt class="py-lineno">213</tt>  <tt class="py-line"> </tt>
<a name="Session._catch_stream_id"></a><div id="Session._catch_stream_id-def"><a name="L214"></a><tt class="py-lineno">214</tt> <a class="py-toggle" href="#" id="Session._catch_stream_id-toggle" onclick="return toggle('Session._catch_stream_id');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#_catch_stream_id">_catch_stream_id</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">ns</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">tag</tt><tt class="py-op">=</tt><tt class="py-string">'stream'</tt><tt class="py-op">,</tt><tt class="py-param">attrs</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session._catch_stream_id-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session._catch_stream_id-expanded"><a name="L215"></a><tt class="py-lineno">215</tt>  <tt class="py-line">        <tt class="py-docstring">""" This callback is used to detect the stream namespace of incoming stream. Used internally. """</tt> </tt>
<a name="L216"></a><tt class="py-lineno">216</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">attrs</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'id'</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-keyword">not</tt> <tt class="py-name">attrs</tt><tt class="py-op">[</tt><tt class="py-string">'id'</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L217"></a><tt class="py-lineno">217</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-76" class="py-name"><a title="xmpp.session.Session.terminate_stream" class="py-name" href="#" onclick="return doclink('link-76', 'terminate_stream', 'link-69');">terminate_stream</a></tt><tt class="py-op">(</tt><tt id="link-77" class="py-name" targets="Variable xmpp.STREAM_INVALID_XML=xmpp-module.html#STREAM_INVALID_XML,Variable xmpp.auth.STREAM_INVALID_XML=xmpp.auth-module.html#STREAM_INVALID_XML,Variable xmpp.browser.STREAM_INVALID_XML=xmpp.browser-module.html#STREAM_INVALID_XML,Variable xmpp.commands.STREAM_INVALID_XML=xmpp.commands-module.html#STREAM_INVALID_XML,Variable xmpp.dispatcher.STREAM_INVALID_XML=xmpp.dispatcher-module.html#STREAM_INVALID_XML,Variable xmpp.features.STREAM_INVALID_XML=xmpp.features-module.html#STREAM_INVALID_XML,Variable xmpp.filetransfer.STREAM_INVALID_XML=xmpp.filetransfer-module.html#STREAM_INVALID_XML,Variable xmpp.protocol.STREAM_INVALID_XML=xmpp.protocol-module.html#STREAM_INVALID_XML,Variable xmpp.roster.STREAM_INVALID_XML=xmpp.roster-module.html#STREAM_INVALID_XML,Variable xmpp.session.STREAM_INVALID_XML=xmpp.session-module.html#STREAM_INVALID_XML,Variable xmpp.transports.STREAM_INVALID_XML=xmpp.transports-module.html#STREAM_INVALID_XML"><a title="xmpp.STREAM_INVALID_XML
xmpp.auth.STREAM_INVALID_XML
xmpp.browser.STREAM_INVALID_XML
xmpp.commands.STREAM_INVALID_XML
xmpp.dispatcher.STREAM_INVALID_XML
xmpp.features.STREAM_INVALID_XML
xmpp.filetransfer.STREAM_INVALID_XML
xmpp.protocol.STREAM_INVALID_XML
xmpp.roster.STREAM_INVALID_XML
xmpp.session.STREAM_INVALID_XML
xmpp.transports.STREAM_INVALID_XML" class="py-name" href="#" onclick="return doclink('link-77', 'STREAM_INVALID_XML', 'link-77');">STREAM_INVALID_XML</a></tt><tt class="py-op">)</tt> </tt>
<a name="L218"></a><tt class="py-lineno">218</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-78" class="py-name"><a title="xmpp.dispatcher.ID" class="py-name" href="#" onclick="return doclink('link-78', 'ID', 'link-22');">ID</a></tt><tt class="py-op">=</tt><tt class="py-name">attrs</tt><tt class="py-op">[</tt><tt class="py-string">'id'</tt><tt class="py-op">]</tt> </tt>
<a name="L219"></a><tt class="py-lineno">219</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">attrs</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'version'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt class="py-name">Dialback</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
</div><a name="L220"></a><tt class="py-lineno">220</tt>  <tt class="py-line"> </tt>
<a name="Session._stream_open"></a><div id="Session._stream_open-def"><a name="L221"></a><tt class="py-lineno">221</tt> <a class="py-toggle" href="#" id="Session._stream_open-toggle" onclick="return toggle('Session._stream_open');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#_stream_open">_stream_open</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">ns</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">tag</tt><tt class="py-op">=</tt><tt class="py-string">'stream'</tt><tt class="py-op">,</tt><tt class="py-param">attrs</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session._stream_open-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session._stream_open-expanded"><a name="L222"></a><tt class="py-lineno">222</tt>  <tt class="py-line">        <tt class="py-docstring">""" This callback is used to handle opening stream tag of the incoming stream.</tt> </tt>
<a name="L223"></a><tt class="py-lineno">223</tt>  <tt class="py-line"><tt class="py-docstring">            In the case of client session it just make some validation.</tt> </tt>
<a name="L224"></a><tt class="py-lineno">224</tt>  <tt class="py-line"><tt class="py-docstring">            Server session also sends server headers and if the stream valid the features node.</tt> </tt>
<a name="L225"></a><tt class="py-lineno">225</tt>  <tt class="py-line"><tt class="py-docstring">            Used internally. """</tt> </tt>
<a name="L226"></a><tt class="py-lineno">226</tt>  <tt class="py-line">        <tt class="py-name">text</tt><tt class="py-op">=</tt><tt class="py-string">'&lt;?xml version="1.0" encoding="utf-8"?&gt;\n&lt;stream:stream'</tt> </tt>
<a name="L227"></a><tt class="py-lineno">227</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">TYP</tt><tt class="py-op">==</tt><tt class="py-string">'client'</tt><tt class="py-op">:</tt> </tt>
<a name="L228"></a><tt class="py-lineno">228</tt>  <tt class="py-line">            <tt class="py-name">text</tt><tt class="py-op">+=</tt><tt class="py-string">' to="%s"'</tt><tt class="py-op">%</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">peer</tt> </tt>
<a name="L229"></a><tt class="py-lineno">229</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L230"></a><tt class="py-lineno">230</tt>  <tt class="py-line">            <tt class="py-name">text</tt><tt class="py-op">+=</tt><tt class="py-string">' id="%s"'</tt><tt class="py-op">%</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-79" class="py-name"><a title="xmpp.dispatcher.ID" class="py-name" href="#" onclick="return doclink('link-79', 'ID', 'link-22');">ID</a></tt> </tt>
<a name="L231"></a><tt class="py-lineno">231</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">attrs</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'to'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-name">text</tt><tt class="py-op">+=</tt><tt class="py-string">' from="%s"'</tt><tt class="py-op">%</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt class="py-name">servernames</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L232"></a><tt class="py-lineno">232</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> <tt class="py-name">text</tt><tt class="py-op">+=</tt><tt class="py-string">' from="%s"'</tt><tt class="py-op">%</tt><tt class="py-name">attrs</tt><tt class="py-op">[</tt><tt class="py-string">'to'</tt><tt class="py-op">]</tt> </tt>
<a name="L233"></a><tt class="py-lineno">233</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">attrs</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'xml:lang'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-name">text</tt><tt class="py-op">+=</tt><tt class="py-string">' xml:lang="%s"'</tt><tt class="py-op">%</tt><tt class="py-name">attrs</tt><tt class="py-op">[</tt><tt class="py-string">'xml:lang'</tt><tt class="py-op">]</tt> </tt>
<a name="L234"></a><tt class="py-lineno">234</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmlns</tt><tt class="py-op">:</tt> <tt class="py-name">xmlns</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmlns</tt> </tt>
<a name="L235"></a><tt class="py-lineno">235</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> <tt class="py-name">xmlns</tt><tt class="py-op">=</tt><tt id="link-80" class="py-name" targets="Variable xmpp.protocol.NS_SERVER=xmpp.protocol-module.html#NS_SERVER"><a title="xmpp.protocol.NS_SERVER" class="py-name" href="#" onclick="return doclink('link-80', 'NS_SERVER', 'link-80');">NS_SERVER</a></tt> </tt>
<a name="L236"></a><tt class="py-lineno">236</tt>  <tt class="py-line">        <tt class="py-name">text</tt><tt class="py-op">+=</tt><tt class="py-string">' xmlns:db="%s" xmlns:stream="%s" xmlns="%s"'</tt><tt class="py-op">%</tt><tt class="py-op">(</tt><tt id="link-81" class="py-name" targets="Variable xmpp.protocol.NS_DIALBACK=xmpp.protocol-module.html#NS_DIALBACK"><a title="xmpp.protocol.NS_DIALBACK" class="py-name" href="#" onclick="return doclink('link-81', 'NS_DIALBACK', 'link-81');">NS_DIALBACK</a></tt><tt class="py-op">,</tt><tt id="link-82" class="py-name" targets="Variable xmpp.protocol.NS_STREAMS=xmpp.protocol-module.html#NS_STREAMS"><a title="xmpp.protocol.NS_STREAMS" class="py-name" href="#" onclick="return doclink('link-82', 'NS_STREAMS', 'link-82');">NS_STREAMS</a></tt><tt class="py-op">,</tt><tt class="py-name">xmlns</tt><tt class="py-op">)</tt> </tt>
<a name="L237"></a><tt class="py-lineno">237</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">attrs</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'version'</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">TYP</tt><tt class="py-op">==</tt><tt class="py-string">'client'</tt><tt class="py-op">:</tt> <tt class="py-name">text</tt><tt class="py-op">+=</tt><tt class="py-string">' version="1.0"'</tt> </tt>
<a name="L238"></a><tt class="py-lineno">238</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-83" class="py-name" targets="Method xmpp.session.Session.sendnow()=xmpp.session.Session-class.html#sendnow"><a title="xmpp.session.Session.sendnow" class="py-name" href="#" onclick="return doclink('link-83', 'sendnow', 'link-83');">sendnow</a></tt><tt class="py-op">(</tt><tt class="py-name">text</tt><tt class="py-op">+</tt><tt class="py-string">'&gt;'</tt><tt class="py-op">)</tt> </tt>
<a name="L239"></a><tt class="py-lineno">239</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-84" class="py-name" targets="Method xmpp.session.Session.set_stream_state()=xmpp.session.Session-class.html#set_stream_state"><a title="xmpp.session.Session.set_stream_state" class="py-name" href="#" onclick="return doclink('link-84', 'set_stream_state', 'link-84');">set_stream_state</a></tt><tt class="py-op">(</tt><tt id="link-85" class="py-name"><a title="xmpp.session.STREAM__OPENED" class="py-name" href="#" onclick="return doclink('link-85', 'STREAM__OPENED', 'link-6');">STREAM__OPENED</a></tt><tt class="py-op">)</tt> </tt>
<a name="L240"></a><tt class="py-lineno">240</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">TYP</tt><tt class="py-op">==</tt><tt class="py-string">'client'</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> </tt>
<a name="L241"></a><tt class="py-lineno">241</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">tag</tt><tt class="py-op">&lt;&gt;</tt><tt class="py-string">'stream'</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-86" class="py-name"><a title="xmpp.session.Session.terminate_stream" class="py-name" href="#" onclick="return doclink('link-86', 'terminate_stream', 'link-69');">terminate_stream</a></tt><tt class="py-op">(</tt><tt id="link-87" class="py-name"><a title="xmpp.STREAM_INVALID_XML
xmpp.auth.STREAM_INVALID_XML
xmpp.browser.STREAM_INVALID_XML
xmpp.commands.STREAM_INVALID_XML
xmpp.dispatcher.STREAM_INVALID_XML
xmpp.features.STREAM_INVALID_XML
xmpp.filetransfer.STREAM_INVALID_XML
xmpp.protocol.STREAM_INVALID_XML
xmpp.roster.STREAM_INVALID_XML
xmpp.session.STREAM_INVALID_XML
xmpp.transports.STREAM_INVALID_XML" class="py-name" href="#" onclick="return doclink('link-87', 'STREAM_INVALID_XML', 'link-77');">STREAM_INVALID_XML</a></tt><tt class="py-op">)</tt> </tt>
<a name="L242"></a><tt class="py-lineno">242</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">ns</tt><tt class="py-op">&lt;&gt;</tt><tt id="link-88" class="py-name"><a title="xmpp.protocol.NS_STREAMS" class="py-name" href="#" onclick="return doclink('link-88', 'NS_STREAMS', 'link-82');">NS_STREAMS</a></tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-89" class="py-name"><a title="xmpp.session.Session.terminate_stream" class="py-name" href="#" onclick="return doclink('link-89', 'terminate_stream', 'link-69');">terminate_stream</a></tt><tt class="py-op">(</tt><tt id="link-90" class="py-name" targets="Variable xmpp.STREAM_INVALID_NAMESPACE=xmpp-module.html#STREAM_INVALID_NAMESPACE,Variable xmpp.auth.STREAM_INVALID_NAMESPACE=xmpp.auth-module.html#STREAM_INVALID_NAMESPACE,Variable xmpp.browser.STREAM_INVALID_NAMESPACE=xmpp.browser-module.html#STREAM_INVALID_NAMESPACE,Variable xmpp.commands.STREAM_INVALID_NAMESPACE=xmpp.commands-module.html#STREAM_INVALID_NAMESPACE,Variable xmpp.dispatcher.STREAM_INVALID_NAMESPACE=xmpp.dispatcher-module.html#STREAM_INVALID_NAMESPACE,Variable xmpp.features.STREAM_INVALID_NAMESPACE=xmpp.features-module.html#STREAM_INVALID_NAMESPACE,Variable xmpp.filetransfer.STREAM_INVALID_NAMESPACE=xmpp.filetransfer-module.html#STREAM_INVALID_NAMESPACE,Variable xmpp.protocol.STREAM_INVALID_NAMESPACE=xmpp.protocol-module.html#STREAM_INVALID_NAMESPACE,Variable xmpp.roster.STREAM_INVALID_NAMESPACE=xmpp.roster-module.html#STREAM_INVALID_NAMESPACE,Variable xmpp.session.STREAM_INVALID_NAMESPACE=xmpp.session-module.html#STREAM_INVALID_NAMESPACE,Variable xmpp.transports.STREAM_INVALID_NAMESPACE=xmpp.transports-module.html#STREAM_INVALID_NAMESPACE"><a title="xmpp.STREAM_INVALID_NAMESPACE
xmpp.auth.STREAM_INVALID_NAMESPACE
xmpp.browser.STREAM_INVALID_NAMESPACE
xmpp.commands.STREAM_INVALID_NAMESPACE
xmpp.dispatcher.STREAM_INVALID_NAMESPACE
xmpp.features.STREAM_INVALID_NAMESPACE
xmpp.filetransfer.STREAM_INVALID_NAMESPACE
xmpp.protocol.STREAM_INVALID_NAMESPACE
xmpp.roster.STREAM_INVALID_NAMESPACE
xmpp.session.STREAM_INVALID_NAMESPACE
xmpp.transports.STREAM_INVALID_NAMESPACE" class="py-name" href="#" onclick="return doclink('link-90', 'STREAM_INVALID_NAMESPACE', 'link-90');">STREAM_INVALID_NAMESPACE</a></tt><tt class="py-op">)</tt> </tt>
<a name="L243"></a><tt class="py-lineno">243</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">.</tt><tt class="py-name">xmlns</tt><tt class="py-op">&lt;&gt;</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">xmlns</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-91" class="py-name"><a title="xmpp.session.Session.terminate_stream" class="py-name" href="#" onclick="return doclink('link-91', 'terminate_stream', 'link-69');">terminate_stream</a></tt><tt class="py-op">(</tt><tt id="link-92" class="py-name" targets="Variable xmpp.STREAM_BAD_NAMESPACE_PREFIX=xmpp-module.html#STREAM_BAD_NAMESPACE_PREFIX,Variable xmpp.auth.STREAM_BAD_NAMESPACE_PREFIX=xmpp.auth-module.html#STREAM_BAD_NAMESPACE_PREFIX,Variable xmpp.browser.STREAM_BAD_NAMESPACE_PREFIX=xmpp.browser-module.html#STREAM_BAD_NAMESPACE_PREFIX,Variable xmpp.commands.STREAM_BAD_NAMESPACE_PREFIX=xmpp.commands-module.html#STREAM_BAD_NAMESPACE_PREFIX,Variable xmpp.dispatcher.STREAM_BAD_NAMESPACE_PREFIX=xmpp.dispatcher-module.html#STREAM_BAD_NAMESPACE_PREFIX,Variable xmpp.features.STREAM_BAD_NAMESPACE_PREFIX=xmpp.features-module.html#STREAM_BAD_NAMESPACE_PREFIX,Variable xmpp.filetransfer.STREAM_BAD_NAMESPACE_PREFIX=xmpp.filetransfer-module.html#STREAM_BAD_NAMESPACE_PREFIX,Variable xmpp.protocol.STREAM_BAD_NAMESPACE_PREFIX=xmpp.protocol-module.html#STREAM_BAD_NAMESPACE_PREFIX,Variable xmpp.roster.STREAM_BAD_NAMESPACE_PREFIX=xmpp.roster-module.html#STREAM_BAD_NAMESPACE_PREFIX,Variable xmpp.session.STREAM_BAD_NAMESPACE_PREFIX=xmpp.session-module.html#STREAM_BAD_NAMESPACE_PREFIX,Variable xmpp.transports.STREAM_BAD_NAMESPACE_PREFIX=xmpp.transports-module.html#STREAM_BAD_NAMESPACE_PREFIX"><a title="xmpp.STREAM_BAD_NAMESPACE_PREFIX
xmpp.auth.STREAM_BAD_NAMESPACE_PREFIX
xmpp.browser.STREAM_BAD_NAMESPACE_PREFIX
xmpp.commands.STREAM_BAD_NAMESPACE_PREFIX
xmpp.dispatcher.STREAM_BAD_NAMESPACE_PREFIX
xmpp.features.STREAM_BAD_NAMESPACE_PREFIX
xmpp.filetransfer.STREAM_BAD_NAMESPACE_PREFIX
xmpp.protocol.STREAM_BAD_NAMESPACE_PREFIX
xmpp.roster.STREAM_BAD_NAMESPACE_PREFIX
xmpp.session.STREAM_BAD_NAMESPACE_PREFIX
xmpp.transports.STREAM_BAD_NAMESPACE_PREFIX" class="py-name" href="#" onclick="return doclink('link-92', 'STREAM_BAD_NAMESPACE_PREFIX', 'link-92');">STREAM_BAD_NAMESPACE_PREFIX</a></tt><tt class="py-op">)</tt> </tt>
<a name="L244"></a><tt class="py-lineno">244</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">attrs</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'to'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-93" class="py-name"><a title="xmpp.session.Session.terminate_stream" class="py-name" href="#" onclick="return doclink('link-93', 'terminate_stream', 'link-69');">terminate_stream</a></tt><tt class="py-op">(</tt><tt id="link-94" class="py-name" targets="Variable xmpp.STREAM_IMPROPER_ADDRESSING=xmpp-module.html#STREAM_IMPROPER_ADDRESSING,Variable xmpp.auth.STREAM_IMPROPER_ADDRESSING=xmpp.auth-module.html#STREAM_IMPROPER_ADDRESSING,Variable xmpp.browser.STREAM_IMPROPER_ADDRESSING=xmpp.browser-module.html#STREAM_IMPROPER_ADDRESSING,Variable xmpp.commands.STREAM_IMPROPER_ADDRESSING=xmpp.commands-module.html#STREAM_IMPROPER_ADDRESSING,Variable xmpp.dispatcher.STREAM_IMPROPER_ADDRESSING=xmpp.dispatcher-module.html#STREAM_IMPROPER_ADDRESSING,Variable xmpp.features.STREAM_IMPROPER_ADDRESSING=xmpp.features-module.html#STREAM_IMPROPER_ADDRESSING,Variable xmpp.filetransfer.STREAM_IMPROPER_ADDRESSING=xmpp.filetransfer-module.html#STREAM_IMPROPER_ADDRESSING,Variable xmpp.protocol.STREAM_IMPROPER_ADDRESSING=xmpp.protocol-module.html#STREAM_IMPROPER_ADDRESSING,Variable xmpp.roster.STREAM_IMPROPER_ADDRESSING=xmpp.roster-module.html#STREAM_IMPROPER_ADDRESSING,Variable xmpp.session.STREAM_IMPROPER_ADDRESSING=xmpp.session-module.html#STREAM_IMPROPER_ADDRESSING,Variable xmpp.transports.STREAM_IMPROPER_ADDRESSING=xmpp.transports-module.html#STREAM_IMPROPER_ADDRESSING"><a title="xmpp.STREAM_IMPROPER_ADDRESSING
xmpp.auth.STREAM_IMPROPER_ADDRESSING
xmpp.browser.STREAM_IMPROPER_ADDRESSING
xmpp.commands.STREAM_IMPROPER_ADDRESSING
xmpp.dispatcher.STREAM_IMPROPER_ADDRESSING
xmpp.features.STREAM_IMPROPER_ADDRESSING
xmpp.filetransfer.STREAM_IMPROPER_ADDRESSING
xmpp.protocol.STREAM_IMPROPER_ADDRESSING
xmpp.roster.STREAM_IMPROPER_ADDRESSING
xmpp.session.STREAM_IMPROPER_ADDRESSING
xmpp.transports.STREAM_IMPROPER_ADDRESSING" class="py-name" href="#" onclick="return doclink('link-94', 'STREAM_IMPROPER_ADDRESSING', 'link-94');">STREAM_IMPROPER_ADDRESSING</a></tt><tt class="py-op">)</tt> </tt>
<a name="L245"></a><tt class="py-lineno">245</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">attrs</tt><tt class="py-op">[</tt><tt class="py-string">'to'</tt><tt class="py-op">]</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt class="py-name">servernames</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-95" class="py-name"><a title="xmpp.session.Session.terminate_stream" class="py-name" href="#" onclick="return doclink('link-95', 'terminate_stream', 'link-69');">terminate_stream</a></tt><tt class="py-op">(</tt><tt id="link-96" class="py-name" targets="Variable xmpp.STREAM_HOST_UNKNOWN=xmpp-module.html#STREAM_HOST_UNKNOWN,Variable xmpp.auth.STREAM_HOST_UNKNOWN=xmpp.auth-module.html#STREAM_HOST_UNKNOWN,Variable xmpp.browser.STREAM_HOST_UNKNOWN=xmpp.browser-module.html#STREAM_HOST_UNKNOWN,Variable xmpp.commands.STREAM_HOST_UNKNOWN=xmpp.commands-module.html#STREAM_HOST_UNKNOWN,Variable xmpp.dispatcher.STREAM_HOST_UNKNOWN=xmpp.dispatcher-module.html#STREAM_HOST_UNKNOWN,Variable xmpp.features.STREAM_HOST_UNKNOWN=xmpp.features-module.html#STREAM_HOST_UNKNOWN,Variable xmpp.filetransfer.STREAM_HOST_UNKNOWN=xmpp.filetransfer-module.html#STREAM_HOST_UNKNOWN,Variable xmpp.protocol.STREAM_HOST_UNKNOWN=xmpp.protocol-module.html#STREAM_HOST_UNKNOWN,Variable xmpp.roster.STREAM_HOST_UNKNOWN=xmpp.roster-module.html#STREAM_HOST_UNKNOWN,Variable xmpp.session.STREAM_HOST_UNKNOWN=xmpp.session-module.html#STREAM_HOST_UNKNOWN,Variable xmpp.transports.STREAM_HOST_UNKNOWN=xmpp.transports-module.html#STREAM_HOST_UNKNOWN"><a title="xmpp.STREAM_HOST_UNKNOWN
xmpp.auth.STREAM_HOST_UNKNOWN
xmpp.browser.STREAM_HOST_UNKNOWN
xmpp.commands.STREAM_HOST_UNKNOWN
xmpp.dispatcher.STREAM_HOST_UNKNOWN
xmpp.features.STREAM_HOST_UNKNOWN
xmpp.filetransfer.STREAM_HOST_UNKNOWN
xmpp.protocol.STREAM_HOST_UNKNOWN
xmpp.roster.STREAM_HOST_UNKNOWN
xmpp.session.STREAM_HOST_UNKNOWN
xmpp.transports.STREAM_HOST_UNKNOWN" class="py-name" href="#" onclick="return doclink('link-96', 'STREAM_HOST_UNKNOWN', 'link-96');">STREAM_HOST_UNKNOWN</a></tt><tt class="py-op">)</tt> </tt>
<a name="L246"></a><tt class="py-lineno">246</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">ourname</tt><tt class="py-op">=</tt><tt class="py-name">attrs</tt><tt class="py-op">[</tt><tt class="py-string">'to'</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">lower</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L247"></a><tt class="py-lineno">247</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">TYP</tt><tt class="py-op">==</tt><tt class="py-string">'server'</tt> <tt class="py-keyword">and</tt> <tt class="py-name">attrs</tt><tt class="py-op">.</tt><tt class="py-name">has_key</tt><tt class="py-op">(</tt><tt class="py-string">'version'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L248"></a><tt class="py-lineno">248</tt>  <tt class="py-line">            <tt class="py-comment"># send features</tt> </tt>
<a name="L249"></a><tt class="py-lineno">249</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt id="link-97" class="py-name"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-97', 'features', 'link-31');">features</a></tt><tt class="py-op">=</tt><tt id="link-98" class="py-name"><a title="xmpp.simplexml.Node" class="py-name" href="#" onclick="return doclink('link-98', 'Node', 'link-51');">Node</a></tt><tt class="py-op">(</tt><tt class="py-string">'stream:features'</tt><tt class="py-op">)</tt> </tt>
<a name="L250"></a><tt class="py-lineno">250</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt id="link-99" class="py-name"><a title="xmpp.protocol.NS_TLS" class="py-name" href="#" onclick="return doclink('link-99', 'NS_TLS', 'link-26');">NS_TLS</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">waiting_features</tt><tt class="py-op">:</tt> </tt>
<a name="L251"></a><tt class="py-lineno">251</tt>  <tt class="py-line">                <tt id="link-100" class="py-name"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-100', 'features', 'link-31');">features</a></tt><tt class="py-op">.</tt><tt id="link-101" class="py-name" targets="Class xmpp.simplexml.NT=xmpp.simplexml.NT-class.html"><a title="xmpp.simplexml.NT" class="py-name" href="#" onclick="return doclink('link-101', 'NT', 'link-101');">NT</a></tt><tt class="py-op">.</tt><tt class="py-name">starttls</tt><tt class="py-op">.</tt><tt id="link-102" class="py-name" targets="Method xmpp.simplexml.Node.setNamespace()=xmpp.simplexml.Node-class.html#setNamespace"><a title="xmpp.simplexml.Node.setNamespace" class="py-name" href="#" onclick="return doclink('link-102', 'setNamespace', 'link-102');">setNamespace</a></tt><tt class="py-op">(</tt><tt id="link-103" class="py-name"><a title="xmpp.protocol.NS_TLS" class="py-name" href="#" onclick="return doclink('link-103', 'NS_TLS', 'link-26');">NS_TLS</a></tt><tt class="py-op">)</tt> </tt>
<a name="L252"></a><tt class="py-lineno">252</tt>  <tt class="py-line">                <tt id="link-104" class="py-name"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-104', 'features', 'link-31');">features</a></tt><tt class="py-op">.</tt><tt id="link-105" class="py-name" targets="Class xmpp.simplexml.T=xmpp.simplexml.T-class.html"><a title="xmpp.simplexml.T" class="py-name" href="#" onclick="return doclink('link-105', 'T', 'link-105');">T</a></tt><tt class="py-op">.</tt><tt class="py-name">starttls</tt><tt class="py-op">.</tt><tt id="link-106" class="py-name"><a title="xmpp.simplexml.NT" class="py-name" href="#" onclick="return doclink('link-106', 'NT', 'link-101');">NT</a></tt><tt class="py-op">.</tt><tt class="py-name">required</tt> </tt>
<a name="L253"></a><tt class="py-lineno">253</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt id="link-107" class="py-name"><a title="xmpp.protocol.NS_SASL" class="py-name" href="#" onclick="return doclink('link-107', 'NS_SASL', 'link-27');">NS_SASL</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">waiting_features</tt><tt class="py-op">:</tt> </tt>
<a name="L254"></a><tt class="py-lineno">254</tt>  <tt class="py-line">                <tt id="link-108" class="py-name"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-108', 'features', 'link-31');">features</a></tt><tt class="py-op">.</tt><tt id="link-109" class="py-name"><a title="xmpp.simplexml.NT" class="py-name" href="#" onclick="return doclink('link-109', 'NT', 'link-101');">NT</a></tt><tt class="py-op">.</tt><tt class="py-name">mechanisms</tt><tt class="py-op">.</tt><tt id="link-110" class="py-name"><a title="xmpp.simplexml.Node.setNamespace" class="py-name" href="#" onclick="return doclink('link-110', 'setNamespace', 'link-102');">setNamespace</a></tt><tt class="py-op">(</tt><tt id="link-111" class="py-name"><a title="xmpp.protocol.NS_SASL" class="py-name" href="#" onclick="return doclink('link-111', 'NS_SASL', 'link-27');">NS_SASL</a></tt><tt class="py-op">)</tt> </tt>
<a name="L255"></a><tt class="py-lineno">255</tt>  <tt class="py-line">                <tt class="py-keyword">for</tt> <tt class="py-name">mec</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt id="link-112" class="py-name" targets="Class xmpp.auth.SASL=xmpp.auth.SASL-class.html"><a title="xmpp.auth.SASL" class="py-name" href="#" onclick="return doclink('link-112', 'SASL', 'link-112');">SASL</a></tt><tt class="py-op">.</tt><tt class="py-name">mechanisms</tt><tt class="py-op">:</tt> </tt>
<a name="L256"></a><tt class="py-lineno">256</tt>  <tt class="py-line">                    <tt id="link-113" class="py-name"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-113', 'features', 'link-31');">features</a></tt><tt class="py-op">.</tt><tt id="link-114" class="py-name"><a title="xmpp.simplexml.T" class="py-name" href="#" onclick="return doclink('link-114', 'T', 'link-105');">T</a></tt><tt class="py-op">.</tt><tt class="py-name">mechanisms</tt><tt class="py-op">.</tt><tt id="link-115" class="py-name"><a title="xmpp.simplexml.NT" class="py-name" href="#" onclick="return doclink('link-115', 'NT', 'link-101');">NT</a></tt><tt class="py-op">.</tt><tt class="py-name">mechanism</tt><tt class="py-op">=</tt><tt class="py-name">mec</tt> </tt>
<a name="L257"></a><tt class="py-lineno">257</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L258"></a><tt class="py-lineno">258</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt id="link-116" class="py-name"><a title="xmpp.protocol.NS_BIND" class="py-name" href="#" onclick="return doclink('link-116', 'NS_BIND', 'link-28');">NS_BIND</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">waiting_features</tt><tt class="py-op">:</tt> <tt id="link-117" class="py-name"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-117', 'features', 'link-31');">features</a></tt><tt class="py-op">.</tt><tt id="link-118" class="py-name"><a title="xmpp.simplexml.NT" class="py-name" href="#" onclick="return doclink('link-118', 'NT', 'link-101');">NT</a></tt><tt class="py-op">.</tt><tt class="py-name">bind</tt><tt class="py-op">.</tt><tt id="link-119" class="py-name"><a title="xmpp.simplexml.Node.setNamespace" class="py-name" href="#" onclick="return doclink('link-119', 'setNamespace', 'link-102');">setNamespace</a></tt><tt class="py-op">(</tt><tt id="link-120" class="py-name"><a title="xmpp.protocol.NS_BIND" class="py-name" href="#" onclick="return doclink('link-120', 'NS_BIND', 'link-28');">NS_BIND</a></tt><tt class="py-op">)</tt> </tt>
<a name="L259"></a><tt class="py-lineno">259</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt id="link-121" class="py-name"><a title="xmpp.protocol.NS_SESSION" class="py-name" href="#" onclick="return doclink('link-121', 'NS_SESSION', 'link-29');">NS_SESSION</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">waiting_features</tt><tt class="py-op">:</tt> <tt id="link-122" class="py-name"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-122', 'features', 'link-31');">features</a></tt><tt class="py-op">.</tt><tt id="link-123" class="py-name"><a title="xmpp.simplexml.NT" class="py-name" href="#" onclick="return doclink('link-123', 'NT', 'link-101');">NT</a></tt><tt class="py-op">.</tt><tt id="link-124" class="py-name" targets="Module xmpp.session=xmpp.session-module.html"><a title="xmpp.session" class="py-name" href="#" onclick="return doclink('link-124', 'session', 'link-124');">session</a></tt><tt class="py-op">.</tt><tt id="link-125" class="py-name"><a title="xmpp.simplexml.Node.setNamespace" class="py-name" href="#" onclick="return doclink('link-125', 'setNamespace', 'link-102');">setNamespace</a></tt><tt class="py-op">(</tt><tt id="link-126" class="py-name"><a title="xmpp.protocol.NS_SESSION" class="py-name" href="#" onclick="return doclink('link-126', 'NS_SESSION', 'link-29');">NS_SESSION</a></tt><tt class="py-op">)</tt> </tt>
<a name="L260"></a><tt class="py-lineno">260</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-127" class="py-name"><a title="xmpp.session.Session.sendnow" class="py-name" href="#" onclick="return doclink('link-127', 'sendnow', 'link-83');">sendnow</a></tt><tt class="py-op">(</tt><tt id="link-128" class="py-name"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-128', 'features', 'link-31');">features</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L261"></a><tt class="py-lineno">261</tt>  <tt class="py-line"> </tt>
<a name="Session.feature"></a><div id="Session.feature-def"><a name="L262"></a><tt class="py-lineno">262</tt> <a class="py-toggle" href="#" id="Session.feature-toggle" onclick="return toggle('Session.feature');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#feature">feature</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">feature</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.feature-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.feature-expanded"><a name="L263"></a><tt class="py-lineno">263</tt>  <tt class="py-line">        <tt class="py-docstring">""" Declare some stream feature as activated one. """</tt> </tt>
<a name="L264"></a><tt class="py-lineno">264</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-129" class="py-name"><a title="xmpp.session.Session.feature" class="py-name" href="#" onclick="return doclink('link-129', 'feature', 'link-25');">feature</a></tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-130" class="py-name"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-130', 'features', 'link-31');">features</a></tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-131" class="py-name"><a title="xmpp.features" class="py-name" href="#" onclick="return doclink('link-131', 'features', 'link-31');">features</a></tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt id="link-132" class="py-name"><a title="xmpp.session.Session.feature" class="py-name" href="#" onclick="return doclink('link-132', 'feature', 'link-25');">feature</a></tt><tt class="py-op">)</tt> </tt>
<a name="L265"></a><tt class="py-lineno">265</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-133" class="py-name" targets="Method xmpp.session.Session.unfeature()=xmpp.session.Session-class.html#unfeature"><a title="xmpp.session.Session.unfeature" class="py-name" href="#" onclick="return doclink('link-133', 'unfeature', 'link-133');">unfeature</a></tt><tt class="py-op">(</tt><tt id="link-134" class="py-name"><a title="xmpp.session.Session.feature" class="py-name" href="#" onclick="return doclink('link-134', 'feature', 'link-25');">feature</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L266"></a><tt class="py-lineno">266</tt>  <tt class="py-line"> </tt>
<a name="Session.unfeature"></a><div id="Session.unfeature-def"><a name="L267"></a><tt class="py-lineno">267</tt> <a class="py-toggle" href="#" id="Session.unfeature-toggle" onclick="return toggle('Session.unfeature');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#unfeature">unfeature</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">feature</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.unfeature-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.unfeature-expanded"><a name="L268"></a><tt class="py-lineno">268</tt>  <tt class="py-line">        <tt class="py-docstring">""" Declare some feature as illegal. Illegal features can not be used.</tt> </tt>
<a name="L269"></a><tt class="py-lineno">269</tt>  <tt class="py-line"><tt class="py-docstring">            Example: BIND feature becomes illegal after Non-SASL auth. """</tt> </tt>
<a name="L270"></a><tt class="py-lineno">270</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-135" class="py-name"><a title="xmpp.session.Session.feature" class="py-name" href="#" onclick="return doclink('link-135', 'feature', 'link-25');">feature</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">waiting_features</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">waiting_features</tt><tt class="py-op">.</tt><tt class="py-name">remove</tt><tt class="py-op">(</tt><tt id="link-136" class="py-name"><a title="xmpp.session.Session.feature" class="py-name" href="#" onclick="return doclink('link-136', 'feature', 'link-25');">feature</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L271"></a><tt class="py-lineno">271</tt>  <tt class="py-line"> </tt>
<a name="Session._stream_close"></a><div id="Session._stream_close-def"><a name="L272"></a><tt class="py-lineno">272</tt> <a class="py-toggle" href="#" id="Session._stream_close-toggle" onclick="return toggle('Session._stream_close');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#_stream_close">_stream_close</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">unregister</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session._stream_close-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session._stream_close-expanded"><a name="L273"></a><tt class="py-lineno">273</tt>  <tt class="py-line">        <tt class="py-docstring">""" Write the closing stream tag and destroy the underlaying socket. Used internally. """</tt> </tt>
<a name="L274"></a><tt class="py-lineno">274</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_state</tt><tt class="py-op">&gt;=</tt><tt id="link-137" class="py-name"><a title="xmpp.session.STREAM__CLOSED" class="py-name" href="#" onclick="return doclink('link-137', 'STREAM__CLOSED', 'link-8');">STREAM__CLOSED</a></tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> </tt>
<a name="L275"></a><tt class="py-lineno">275</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-138" class="py-name"><a title="xmpp.session.Session.set_stream_state" class="py-name" href="#" onclick="return doclink('link-138', 'set_stream_state', 'link-84');">set_stream_state</a></tt><tt class="py-op">(</tt><tt id="link-139" class="py-name"><a title="xmpp.session.STREAM__CLOSING" class="py-name" href="#" onclick="return doclink('link-139', 'STREAM__CLOSING', 'link-7');">STREAM__CLOSING</a></tt><tt class="py-op">)</tt> </tt>
<a name="L276"></a><tt class="py-lineno">276</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-140" class="py-name"><a title="xmpp.session.Session.sendnow" class="py-name" href="#" onclick="return doclink('link-140', 'sendnow', 'link-83');">sendnow</a></tt><tt class="py-op">(</tt><tt class="py-string">'&lt;/stream:stream&gt;'</tt><tt class="py-op">)</tt> </tt>
<a name="L277"></a><tt class="py-lineno">277</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-141" class="py-name"><a title="xmpp.session.Session.set_stream_state" class="py-name" href="#" onclick="return doclink('link-141', 'set_stream_state', 'link-84');">set_stream_state</a></tt><tt class="py-op">(</tt><tt id="link-142" class="py-name"><a title="xmpp.session.STREAM__CLOSED" class="py-name" href="#" onclick="return doclink('link-142', 'STREAM__CLOSED', 'link-8');">STREAM__CLOSED</a></tt><tt class="py-op">)</tt> </tt>
<a name="L278"></a><tt class="py-lineno">278</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-143" class="py-name"><a title="xmpp.session.Session.push_queue" class="py-name" href="#" onclick="return doclink('link-143', 'push_queue', 'link-56');">push_queue</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt>       <tt class="py-comment"># decompose queue really since STREAM__CLOSED</tt> </tt>
<a name="L279"></a><tt class="py-lineno">279</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt class="py-name">flush_queues</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L280"></a><tt class="py-lineno">280</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-144" class="py-name" targets="Function xmpp.features.unregister()=xmpp.features-module.html#unregister"><a title="xmpp.features.unregister" class="py-name" href="#" onclick="return doclink('link-144', 'unregister', 'link-144');">unregister</a></tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_owner</tt><tt class="py-op">.</tt><tt class="py-name">unregistersession</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
<a name="L281"></a><tt class="py-lineno">281</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-145" class="py-name" targets="Method xmpp.session.Session._destroy_socket()=xmpp.session.Session-class.html#_destroy_socket"><a title="xmpp.session.Session._destroy_socket" class="py-name" href="#" onclick="return doclink('link-145', '_destroy_socket', 'link-145');">_destroy_socket</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L282"></a><tt class="py-lineno">282</tt>  <tt class="py-line"> </tt>
<a name="Session.terminate_stream"></a><div id="Session.terminate_stream-def"><a name="L283"></a><tt class="py-lineno">283</tt> <a class="py-toggle" href="#" id="Session.terminate_stream-toggle" onclick="return toggle('Session.terminate_stream');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#terminate_stream">terminate_stream</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">error</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-param">unregister</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.terminate_stream-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.terminate_stream-expanded"><a name="L284"></a><tt class="py-lineno">284</tt>  <tt class="py-line">        <tt class="py-docstring">""" Notify the peer about stream closure.</tt> </tt>
<a name="L285"></a><tt class="py-lineno">285</tt>  <tt class="py-line"><tt class="py-docstring">            Ensure that xmlstream is not brokes - i.e. if the stream isn't opened yet -</tt> </tt>
<a name="L286"></a><tt class="py-lineno">286</tt>  <tt class="py-line"><tt class="py-docstring">            open it before closure.</tt> </tt>
<a name="L287"></a><tt class="py-lineno">287</tt>  <tt class="py-line"><tt class="py-docstring">            If the error condition is specified than create a stream error and send it along with</tt> </tt>
<a name="L288"></a><tt class="py-lineno">288</tt>  <tt class="py-line"><tt class="py-docstring">            closing stream tag.</tt> </tt>
<a name="L289"></a><tt class="py-lineno">289</tt>  <tt class="py-line"><tt class="py-docstring">            Emulate receiving 'unavailable' type presence just before stream closure.</tt> </tt>
<a name="L290"></a><tt class="py-lineno">290</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L291"></a><tt class="py-lineno">291</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_state</tt><tt class="py-op">&gt;=</tt><tt id="link-146" class="py-name"><a title="xmpp.session.STREAM__CLOSING" class="py-name" href="#" onclick="return doclink('link-146', 'STREAM__CLOSING', 'link-7');">STREAM__CLOSING</a></tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> </tt>
<a name="L292"></a><tt class="py-lineno">292</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_state</tt><tt class="py-op">&lt;</tt><tt id="link-147" class="py-name"><a title="xmpp.session.STREAM__OPENED" class="py-name" href="#" onclick="return doclink('link-147', 'STREAM__OPENED', 'link-6');">STREAM__OPENED</a></tt><tt class="py-op">:</tt> </tt>
<a name="L293"></a><tt class="py-lineno">293</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-148" class="py-name"><a title="xmpp.session.Session.set_stream_state" class="py-name" href="#" onclick="return doclink('link-148', 'set_stream_state', 'link-84');">set_stream_state</a></tt><tt class="py-op">(</tt><tt id="link-149" class="py-name"><a title="xmpp.session.STREAM__CLOSING" class="py-name" href="#" onclick="return doclink('link-149', 'STREAM__CLOSING', 'link-7');">STREAM__CLOSING</a></tt><tt class="py-op">)</tt> </tt>
<a name="L294"></a><tt class="py-lineno">294</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-150" class="py-name"><a title="xmpp.session.Session._stream_open" class="py-name" href="#" onclick="return doclink('link-150', '_stream_open', 'link-44');">_stream_open</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L295"></a><tt class="py-lineno">295</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L296"></a><tt class="py-lineno">296</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-151" class="py-name"><a title="xmpp.session.Session.set_stream_state" class="py-name" href="#" onclick="return doclink('link-151', 'set_stream_state', 'link-84');">set_stream_state</a></tt><tt class="py-op">(</tt><tt id="link-152" class="py-name"><a title="xmpp.session.STREAM__CLOSING" class="py-name" href="#" onclick="return doclink('link-152', 'STREAM__CLOSING', 'link-7');">STREAM__CLOSING</a></tt><tt class="py-op">)</tt> </tt>
<a name="L297"></a><tt class="py-lineno">297</tt>  <tt class="py-line">            <tt class="py-name">p</tt><tt class="py-op">=</tt><tt id="link-153" class="py-name" targets="Class xmpp.protocol.Presence=xmpp.protocol.Presence-class.html"><a title="xmpp.protocol.Presence" class="py-name" href="#" onclick="return doclink('link-153', 'Presence', 'link-153');">Presence</a></tt><tt class="py-op">(</tt><tt class="py-name">typ</tt><tt class="py-op">=</tt><tt class="py-string">'unavailable'</tt><tt class="py-op">)</tt> </tt>
<a name="L298"></a><tt class="py-lineno">298</tt>  <tt class="py-line">            <tt class="py-name">p</tt><tt class="py-op">.</tt><tt id="link-154" class="py-name"><a title="xmpp.simplexml.Node.setNamespace" class="py-name" href="#" onclick="return doclink('link-154', 'setNamespace', 'link-102');">setNamespace</a></tt><tt class="py-op">(</tt><tt id="link-155" class="py-name" targets="Variable xmpp.protocol.NS_CLIENT=xmpp.protocol-module.html#NS_CLIENT"><a title="xmpp.protocol.NS_CLIENT" class="py-name" href="#" onclick="return doclink('link-155', 'NS_CLIENT', 'link-155');">NS_CLIENT</a></tt><tt class="py-op">)</tt> </tt>
<a name="L299"></a><tt class="py-lineno">299</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-156" class="py-name"><a title="xmpp.session.Session._dispatch" class="py-name" href="#" onclick="return doclink('link-156', '_dispatch', 'link-39');">_dispatch</a></tt><tt class="py-op">(</tt><tt class="py-name">p</tt><tt class="py-op">,</tt><tt class="py-name">trusted</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
<a name="L300"></a><tt class="py-lineno">300</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-157" class="py-name" targets="Class xmpp.transports.error=xmpp.transports.error-class.html"><a title="xmpp.transports.error" class="py-name" href="#" onclick="return doclink('link-157', 'error', 'link-157');">error</a></tt><tt class="py-op">:</tt> </tt>
<a name="L301"></a><tt class="py-lineno">301</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt id="link-158" class="py-name"><a title="xmpp.transports.error" class="py-name" href="#" onclick="return doclink('link-158', 'error', 'link-157');">error</a></tt><tt class="py-op">,</tt><tt id="link-159" class="py-name"><a title="xmpp.simplexml.Node" class="py-name" href="#" onclick="return doclink('link-159', 'Node', 'link-51');">Node</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-160" class="py-name"><a title="xmpp.session.Session.sendnow" class="py-name" href="#" onclick="return doclink('link-160', 'sendnow', 'link-83');">sendnow</a></tt><tt class="py-op">(</tt><tt id="link-161" class="py-name"><a title="xmpp.transports.error" class="py-name" href="#" onclick="return doclink('link-161', 'error', 'link-157');">error</a></tt><tt class="py-op">)</tt> </tt>
<a name="L302"></a><tt class="py-lineno">302</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-162" class="py-name"><a title="xmpp.session.Session.sendnow" class="py-name" href="#" onclick="return doclink('link-162', 'sendnow', 'link-83');">sendnow</a></tt><tt class="py-op">(</tt><tt id="link-163" class="py-name" targets="Class xmpp.protocol.ErrorNode=xmpp.protocol.ErrorNode-class.html"><a title="xmpp.protocol.ErrorNode" class="py-name" href="#" onclick="return doclink('link-163', 'ErrorNode', 'link-163');">ErrorNode</a></tt><tt class="py-op">(</tt><tt id="link-164" class="py-name"><a title="xmpp.transports.error" class="py-name" href="#" onclick="return doclink('link-164', 'error', 'link-157');">error</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L303"></a><tt class="py-lineno">303</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-165" class="py-name"><a title="xmpp.session.Session._stream_close" class="py-name" href="#" onclick="return doclink('link-165', '_stream_close', 'link-41');">_stream_close</a></tt><tt class="py-op">(</tt><tt id="link-166" class="py-name"><a title="xmpp.features.unregister" class="py-name" href="#" onclick="return doclink('link-166', 'unregister', 'link-144');">unregister</a></tt><tt class="py-op">=</tt><tt id="link-167" class="py-name"><a title="xmpp.features.unregister" class="py-name" href="#" onclick="return doclink('link-167', 'unregister', 'link-144');">unregister</a></tt><tt class="py-op">)</tt> </tt>
<a name="L304"></a><tt class="py-lineno">304</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">slave_session</tt><tt class="py-op">:</tt> </tt>
<a name="L305"></a><tt class="py-lineno">305</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">slave_session</tt><tt class="py-op">.</tt><tt id="link-168" class="py-name"><a title="xmpp.session.Session.terminate_stream" class="py-name" href="#" onclick="return doclink('link-168', 'terminate_stream', 'link-69');">terminate_stream</a></tt><tt class="py-op">(</tt><tt id="link-169" class="py-name" targets="Variable xmpp.STREAM_REMOTE_CONNECTION_FAILED=xmpp-module.html#STREAM_REMOTE_CONNECTION_FAILED,Variable xmpp.auth.STREAM_REMOTE_CONNECTION_FAILED=xmpp.auth-module.html#STREAM_REMOTE_CONNECTION_FAILED,Variable xmpp.browser.STREAM_REMOTE_CONNECTION_FAILED=xmpp.browser-module.html#STREAM_REMOTE_CONNECTION_FAILED,Variable xmpp.commands.STREAM_REMOTE_CONNECTION_FAILED=xmpp.commands-module.html#STREAM_REMOTE_CONNECTION_FAILED,Variable xmpp.dispatcher.STREAM_REMOTE_CONNECTION_FAILED=xmpp.dispatcher-module.html#STREAM_REMOTE_CONNECTION_FAILED,Variable xmpp.features.STREAM_REMOTE_CONNECTION_FAILED=xmpp.features-module.html#STREAM_REMOTE_CONNECTION_FAILED,Variable xmpp.filetransfer.STREAM_REMOTE_CONNECTION_FAILED=xmpp.filetransfer-module.html#STREAM_REMOTE_CONNECTION_FAILED,Variable xmpp.protocol.STREAM_REMOTE_CONNECTION_FAILED=xmpp.protocol-module.html#STREAM_REMOTE_CONNECTION_FAILED,Variable xmpp.roster.STREAM_REMOTE_CONNECTION_FAILED=xmpp.roster-module.html#STREAM_REMOTE_CONNECTION_FAILED,Variable xmpp.session.STREAM_REMOTE_CONNECTION_FAILED=xmpp.session-module.html#STREAM_REMOTE_CONNECTION_FAILED,Variable xmpp.transports.STREAM_REMOTE_CONNECTION_FAILED=xmpp.transports-module.html#STREAM_REMOTE_CONNECTION_FAILED"><a title="xmpp.STREAM_REMOTE_CONNECTION_FAILED
xmpp.auth.STREAM_REMOTE_CONNECTION_FAILED
xmpp.browser.STREAM_REMOTE_CONNECTION_FAILED
xmpp.commands.STREAM_REMOTE_CONNECTION_FAILED
xmpp.dispatcher.STREAM_REMOTE_CONNECTION_FAILED
xmpp.features.STREAM_REMOTE_CONNECTION_FAILED
xmpp.filetransfer.STREAM_REMOTE_CONNECTION_FAILED
xmpp.protocol.STREAM_REMOTE_CONNECTION_FAILED
xmpp.roster.STREAM_REMOTE_CONNECTION_FAILED
xmpp.session.STREAM_REMOTE_CONNECTION_FAILED
xmpp.transports.STREAM_REMOTE_CONNECTION_FAILED" class="py-name" href="#" onclick="return doclink('link-169', 'STREAM_REMOTE_CONNECTION_FAILED', 'link-169');">STREAM_REMOTE_CONNECTION_FAILED</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L306"></a><tt class="py-lineno">306</tt>  <tt class="py-line"> </tt>
<a name="Session._destroy_socket"></a><div id="Session._destroy_socket-def"><a name="L307"></a><tt class="py-lineno">307</tt> <a class="py-toggle" href="#" id="Session._destroy_socket-toggle" onclick="return toggle('Session._destroy_socket');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#_destroy_socket">_destroy_socket</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session._destroy_socket-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session._destroy_socket-expanded"><a name="L308"></a><tt class="py-lineno">308</tt>  <tt class="py-line">        <tt class="py-docstring">""" Break cyclic dependancies to let python's GC free memory right now."""</tt> </tt>
<a name="L309"></a><tt class="py-lineno">309</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">.</tt><tt id="link-170" class="py-name"><a title="xmpp.dispatcher.Dispatcher.dispatch
xmpp.simplexml.NodeBuilder.dispatch" class="py-name" href="#" onclick="return doclink('link-170', 'dispatch', 'link-38');">dispatch</a></tt><tt class="py-op">=</tt><tt class="py-name">None</tt> </tt>
<a name="L310"></a><tt class="py-lineno">310</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">.</tt><tt id="link-171" class="py-name"><a title="xmpp.simplexml.NodeBuilder.stream_footer_received" class="py-name" href="#" onclick="return doclink('link-171', 'stream_footer_received', 'link-40');">stream_footer_received</a></tt><tt class="py-op">=</tt><tt class="py-name">None</tt> </tt>
<a name="L311"></a><tt class="py-lineno">311</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">.</tt><tt id="link-172" class="py-name"><a title="xmpp.simplexml.NodeBuilder.stream_header_received" class="py-name" href="#" onclick="return doclink('link-172', 'stream_header_received', 'link-42');">stream_header_received</a></tt><tt class="py-op">=</tt><tt class="py-name">None</tt> </tt>
<a name="L312"></a><tt class="py-lineno">312</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">Stream</tt><tt class="py-op">.</tt><tt id="link-173" class="py-name" targets="Method xmpp.simplexml.NodeBuilder.destroy()=xmpp.simplexml.NodeBuilder-class.html#destroy"><a title="xmpp.simplexml.NodeBuilder.destroy" class="py-name" href="#" onclick="return doclink('link-173', 'destroy', 'link-173');">destroy</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L313"></a><tt class="py-lineno">313</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_sock</tt><tt class="py-op">.</tt><tt class="py-name">close</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L314"></a><tt class="py-lineno">314</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-174" class="py-name"><a title="xmpp.session.Session.set_socket_state" class="py-name" href="#" onclick="return doclink('link-174', 'set_socket_state', 'link-49');">set_socket_state</a></tt><tt class="py-op">(</tt><tt id="link-175" class="py-name"><a title="xmpp.session.SOCKET_DEAD" class="py-name" href="#" onclick="return doclink('link-175', 'SOCKET_DEAD', 'link-4');">SOCKET_DEAD</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L315"></a><tt class="py-lineno">315</tt>  <tt class="py-line"> </tt>
<a name="Session.start_feature"></a><div id="Session.start_feature-def"><a name="L316"></a><tt class="py-lineno">316</tt> <a class="py-toggle" href="#" id="Session.start_feature-toggle" onclick="return toggle('Session.start_feature');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#start_feature">start_feature</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">f</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.start_feature-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.start_feature-expanded"><a name="L317"></a><tt class="py-lineno">317</tt>  <tt class="py-line">        <tt class="py-docstring">""" Declare some feature as "negotiating now" to prevent other features from start negotiating. """</tt> </tt>
<a name="L318"></a><tt class="py-lineno">318</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">feature_in_process</tt><tt class="py-op">:</tt> <tt class="py-keyword">raise</tt> <tt class="py-string">"Starting feature %s over %s !"</tt><tt class="py-op">%</tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">feature_in_process</tt><tt class="py-op">)</tt> </tt>
<a name="L319"></a><tt class="py-lineno">319</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">feature_in_process</tt><tt class="py-op">=</tt><tt class="py-name">f</tt> </tt>
</div><a name="L320"></a><tt class="py-lineno">320</tt>  <tt class="py-line"> </tt>
<a name="Session.stop_feature"></a><div id="Session.stop_feature-def"><a name="L321"></a><tt class="py-lineno">321</tt> <a class="py-toggle" href="#" id="Session.stop_feature-toggle" onclick="return toggle('Session.stop_feature');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#stop_feature">stop_feature</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">f</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.stop_feature-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.stop_feature-expanded"><a name="L322"></a><tt class="py-lineno">322</tt>  <tt class="py-line">        <tt class="py-docstring">""" Declare some feature as "negotiated" to allow other features start negotiating. """</tt> </tt>
<a name="L323"></a><tt class="py-lineno">323</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">feature_in_process</tt><tt class="py-op">&lt;&gt;</tt><tt class="py-name">f</tt><tt class="py-op">:</tt> <tt class="py-keyword">raise</tt> <tt class="py-string">"Stopping feature %s instead of %s !"</tt><tt class="py-op">%</tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">feature_in_process</tt><tt class="py-op">)</tt> </tt>
<a name="L324"></a><tt class="py-lineno">324</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">feature_in_process</tt><tt class="py-op">=</tt><tt class="py-name">None</tt> </tt>
</div><a name="L325"></a><tt class="py-lineno">325</tt>  <tt class="py-line"> </tt>
<a name="Session.set_socket_state"></a><div id="Session.set_socket_state-def"><a name="L326"></a><tt class="py-lineno">326</tt> <a class="py-toggle" href="#" id="Session.set_socket_state-toggle" onclick="return toggle('Session.set_socket_state');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#set_socket_state">set_socket_state</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">newstate</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.set_socket_state-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.set_socket_state-expanded"><a name="L327"></a><tt class="py-lineno">327</tt>  <tt class="py-line">        <tt class="py-docstring">""" Change the underlaying socket state.</tt> </tt>
<a name="L328"></a><tt class="py-lineno">328</tt>  <tt class="py-line"><tt class="py-docstring">            Socket starts with SOCKET_UNCONNECTED state</tt> </tt>
<a name="L329"></a><tt class="py-lineno">329</tt>  <tt class="py-line"><tt class="py-docstring">            and then proceeds (possibly) to SOCKET_ALIVE</tt> </tt>
<a name="L330"></a><tt class="py-lineno">330</tt>  <tt class="py-line"><tt class="py-docstring">            and then to SOCKET_DEAD """</tt> </tt>
<a name="L331"></a><tt class="py-lineno">331</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_socket_state</tt><tt class="py-op">&lt;</tt><tt class="py-name">newstate</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_socket_state</tt><tt class="py-op">=</tt><tt class="py-name">newstate</tt> </tt>
</div><a name="L332"></a><tt class="py-lineno">332</tt>  <tt class="py-line"> </tt>
<a name="Session.set_session_state"></a><div id="Session.set_session_state-def"><a name="L333"></a><tt class="py-lineno">333</tt> <a class="py-toggle" href="#" id="Session.set_session_state-toggle" onclick="return toggle('Session.set_session_state');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#set_session_state">set_session_state</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">newstate</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.set_session_state-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.set_session_state-expanded"><a name="L334"></a><tt class="py-lineno">334</tt>  <tt class="py-line">        <tt class="py-docstring">""" Change the session state.</tt> </tt>
<a name="L335"></a><tt class="py-lineno">335</tt>  <tt class="py-line"><tt class="py-docstring">            Session starts with SESSION_NOT_AUTHED state</tt> </tt>
<a name="L336"></a><tt class="py-lineno">336</tt>  <tt class="py-line"><tt class="py-docstring">            and then comes through </tt> </tt>
<a name="L337"></a><tt class="py-lineno">337</tt>  <tt class="py-line"><tt class="py-docstring">            SESSION_AUTHED, SESSION_BOUND, SESSION_OPENED and SESSION_CLOSED states.</tt> </tt>
<a name="L338"></a><tt class="py-lineno">338</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L339"></a><tt class="py-lineno">339</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_session_state</tt><tt class="py-op">&lt;</tt><tt class="py-name">newstate</tt><tt class="py-op">:</tt> </tt>
<a name="L340"></a><tt class="py-lineno">340</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_session_state</tt><tt class="py-op">&lt;</tt><tt id="link-176" class="py-name"><a title="xmpp.session.SESSION_AUTHED" class="py-name" href="#" onclick="return doclink('link-176', 'SESSION_AUTHED', 'link-10');">SESSION_AUTHED</a></tt> <tt class="py-keyword">and</tt> \ </tt>
<a name="L341"></a><tt class="py-lineno">341</tt>  <tt class="py-line">               <tt class="py-name">newstate</tt><tt class="py-op">&gt;=</tt><tt id="link-177" class="py-name"><a title="xmpp.session.SESSION_AUTHED" class="py-name" href="#" onclick="return doclink('link-177', 'SESSION_AUTHED', 'link-10');">SESSION_AUTHED</a></tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_pos_queued</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_pos_sent</tt> </tt>
<a name="L342"></a><tt class="py-lineno">342</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_session_state</tt><tt class="py-op">=</tt><tt class="py-name">newstate</tt> </tt>
</div><a name="L343"></a><tt class="py-lineno">343</tt>  <tt class="py-line"> </tt>
<a name="Session.set_stream_state"></a><div id="Session.set_stream_state-def"><a name="L344"></a><tt class="py-lineno">344</tt> <a class="py-toggle" href="#" id="Session.set_stream_state-toggle" onclick="return toggle('Session.set_stream_state');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="xmpp.session.Session-class.html#set_stream_state">set_stream_state</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">newstate</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Session.set_stream_state-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Session.set_stream_state-expanded"><a name="L345"></a><tt class="py-lineno">345</tt>  <tt class="py-line">        <tt class="py-docstring">""" Change the underlaying XML stream state</tt> </tt>
<a name="L346"></a><tt class="py-lineno">346</tt>  <tt class="py-line"><tt class="py-docstring">            Stream starts with STREAM__NOT_OPENED and then proceeds with</tt> </tt>
<a name="L347"></a><tt class="py-lineno">347</tt>  <tt class="py-line"><tt class="py-docstring">            STREAM__OPENED, STREAM__CLOSING and STREAM__CLOSED states.</tt> </tt>
<a name="L348"></a><tt class="py-lineno">348</tt>  <tt class="py-line"><tt class="py-docstring">            Note that some features (like TLS and SASL)</tt> </tt>
<a name="L349"></a><tt class="py-lineno">349</tt>  <tt class="py-line"><tt class="py-docstring">            requires stream re-start so this state can have non-linear changes. """</tt> </tt>
<a name="L350"></a><tt class="py-lineno">350</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_state</tt><tt class="py-op">&lt;</tt><tt class="py-name">newstate</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_stream_state</tt><tt class="py-op">=</tt><tt class="py-name">newstate</tt> </tt>
</div></div><a name="L351"></a><tt class="py-lineno">351</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="xmpp-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Sat Dec 15 22:25:28 2007
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
